Hey guys!

I am working on a project in which I read STL files and show them on screen.

Is there a (easy) way to get the real dimensions from the model to make a true scale?

I am really lost about this question, I don’t know from where I could start.

The models are being scaled to fit on screen and I also rotate them…

Typical 3D model file formats like STL don’t use any unit scaling for their data (specialized files specific to CAD programs usually do), i.e. you have to

rely on whoever designed the 3D model to stick to some agreed scaling (like 1 unit = 1 inch or 1 unit = 1 meter).

If you have that problem solved, you might want to use an orthographic projection or other parallel projection that preserves angles and distance ratios

for displaying the model.

If you then want to display a scale that is as acurate as possible, you need to use operating specific functions to work out the physical dimensions of a

pixel on the screen that you are displaying the model on. That way, you can work how many millimeters (or mil) on the screen a unit in the model occupies.

The relationship between the dimensions on a scale drawing or model and the actual dimensions of the object being represented is described by a ratio. One type of ratio that could be used is called a unit scale, in which units of measure are used to relate scale dimensions to actual dimensions. For example, a unit scale for a scale drawing might be: 1 centimeter = 2 meters.

Another ratio that could be used is called a scale factor. Like a unit scale, a scale factor relates the scale dimensions to actual dimensions however it does so without regard to specific units.

A scale factor for a scale drawing might be 1200.

If you think about the unit scale that we just introduced, 1 centimeter to 2 meters, the scale factor would be 1 to 2.

Let’s look at how we can work with scale factors when given actual dimensions.