PDA

View Full Version : Finding the "center" of a poly face


untelon
11-07-2006, 07:01 PM
but wait ! I am not talking about finding the center as determined by the face's bounding box (the pivot point). I am referring to the location of the actual "dot" of the face.

The problem: I am trying to create an automated "attach" script that will snap objects to poly faces. These faces are randomly placed and oriented. They all have 0 transform information. Their center pivots are all over the place, seldom they are ON the face. Yet the faces (at least in this specific example) are identical and evenly distributed (which will not always be the case).

I want to attach an object to those faces. I do not want them "floating off" of the surface of the face. These needed to be rather precise, hence the automated solution. I figured that a "close" enough solution would be the attach an object the the face's "dot", which is possible as a manual task; nonetheless, I couldn't find a way to achieve this via mel.

If anyone has any ideas I would appreciated it if you could help me out. I can see why maya's resolving of a geometry's bounding box is done in world space, but I think there must be a way of achieving this task.

Thanks much,

unTelon

azshall
11-07-2006, 10:57 PM
http://forums.cgsociety.org/showpost.php?p=3539991&postcount=5

To iterate what the code in that post does ... It queries all the points that make up the face, gets the world space coordinates for each point, averages all of them together to give you a single XYZ coord, thus resulting in the center of the face.

Enjoy :)

Seth

CGTalk Moderation
11-07-2006, 10:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.