Use of inches in the Canvas


I working on a project to simulate an arm swinging (ex. pendulum) but want to se the actual dimensions of an arm. For example 27 inches in length. How can I actually get the length when the canvas is in pixels?



For this, you will need to know the real world dimension of your screen (the display area) and its resolution (Number of pixels for the width and height).

Based on those informations, you can get the real world size of a pixel and use that to draw what you want based on the real world size.

Of course you will need to calculate those values every time you are changing your screen.

If you want to automate it with code, you can have a look at this:


Wikipedia reference:

You may also want to confirm your display measurements (measure) against the specs of your display.