PDA

View Full Version : Detect nurbs normal direction


Darkwox
11-26-2010, 03:03 AM
is there a way to detect if a nurbs surface is point inwards or outwards via mel scripting?

thanks in advance

NaughtyNathan
11-26-2010, 10:42 AM
you first have to determine how does a NURBS surface point in or out?
Which way does a NURBS plane point? If the answer to that is neither in nor out you know immediately that you are going to have a tricky problem on your hands.

If you only want something that will work on very obvious examples (i.e. a cylinder or a sphere) you could probably write something easily. You just need to query the surface normal at several given/random points (pointOnSurface) and compare these to vectors from the same point to the "center" of the surface. if the majority of these vectors point AWAY from the center vectors (dotProduct is < 0) then the surface points "out".

another method which may be quicker and simpler is to use offsetSurface to create an offset. Compare the surface area of the original and the offset. If the offset is BIGGER in area, the surface points "out". This should work in most cases I think..?

:nathaN

Darkwox
11-26-2010, 02:59 PM
thanks NaughtyNathan (http://forums.cgsociety.org/member.php?u=327606):

I think the offset method could be work for me. if I calculate the scale in world units and then use the lower on the offset distance, the new surface should be less (inside its bounding box) than the original surface or if it is a plane, should be in negative position relative to the original surface if it's reversed, am I right?

CGTalk Moderation
11-26-2010, 02:59 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.