computing a scalefactor

Hi all,

I am building an opengl world and I am loading 3d objects of ships, planes, vehicles and so on. I want to compute a scalefactor so that I can scale the vertices of each object. When the objects are drawn on the screen, I want them to be roughly the same size. For example, I may have a ship that is 1000 m long and a jeep that is 10 m long. How can I compute a scalefactor to add to the vertices of each object to make them the same size? Any help would be greatly appreciated.

Hi !

Load all the vertices and calculate a bounding box around the object (find min/max values for X, Y and Z) then you can use wanted_size / calculated_size on each axis to find the scaling factor, then you can draw the object (this would of course make some objects look a bit ugly).


Thanks for the reply. I finally figured out how to do it and make the models look ok. I looked at the models and computed a nominal scale length. say for example 13.5 across all models. I then find the largest difference in the x, y and z vertices. To compute my scalefactor, I divide 13.5 by the difference and get a common scalefactor. Crude but it works for now. Thanks again