View Full Version : Normalising Mesh Models

_new_horizon

09-03-2004, 02:30 PM

My 3D modelling program loads in .obj and .dxf mesh files created by a variety of programs. The problem, is that these are not created equal: some are off-set from the origin while others are too small or too large. What I need is to scale these meshes as they are loaded so that they occupy a normalised unit cube (say -1 to +1 along each axis) without distorting the mesh iteslf.

These seems like a simply problem, but I have yet to resolve it acceptibly. I'm sure someone here knows how to do this. Any takers?

dorbie

09-03-2004, 03:19 PM

1) Compute the bounds.

2) Find the center & size of the bounds.

3) Translate to the origin by subtracting the center from each vertex.

4) Scale to desired size my multiplying the vertex coord by a factor based on the computed size, you may want symmetric or asymmetric scaling.

You should be posting these kinds of basic questions to the beginners forum, where I'm moving this thread.

_new_horizon

09-04-2004, 09:27 AM

"4) Scale to desired size my multiplying the vertex coord by a factor based on the computed size, you may want symmetric or asymmetric scalin"

Yes but what is the factor? And how is it derived? This is the crux of biscuit. I really can't think of a way this could be calculated that would work for a every mesh I load in.

Sorry dorbie, I'll post this kind of stuff in the other forum next time...

say you have some numbers between 0 (min) and 100 (max). if you divide each of these numbers by 100, then youll have numbers between 0 and 1. if you do this for each component (x,y,z), youll have your normalized points.

the only extra step needed is the translation bit if your model isnt centered at the origin. in genreral, you find the model center (sum of all points divided by the number of points), subtract from each point that center, then divide each component of the result by the max unsigned deviation from the center along each axis.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.