Getting face normal

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  02 February 2004
Getting face normal

I'm trying to get the normal of a face. The way i'm doing it now gives me a string. Instead of getting it as a string i would like to get it as a vector variable or to be able to easily convert it to a vector. Here's what i currently do:

polyInfo -faceNormals $selection;

// Result: FACE_NORMAL 43: 0.171929 -0.000000 -0.985109 //

Is there an easy way to get the normal vector of a face? Or is there an easy way to convert this string into a vector variable?

  02 February 2004
Don't know if this is any help, but it goes into getting normals from MEL and was pretty useful for me.

  02 February 2004

I found this little script to help me get a vector of the string i talked about in my last post:

proc vector translatePolyInfoNormal( string $pin )
vector $normal;
float $x;
float $y;
float $z;

string $tokens[];
int $numTokens = `tokenize $pin " " $tokens`;

// Make sure we're looking at polyInfo data:
if ( ( $numTokens > 3 ) && ( $tokens[0] == "FACE_NORMAL" ) )
// Maya performs data-type conversion here.
$x = ($tokens[$numTokens-3]);
$y = ($tokens[$numTokens-2]);
$z = ($tokens[$numTokens-1]);

$normal = << $x, $y, $z >>;

// Normalize it.
$normal = `unit $normal`;

// Return it.
return $normal;

gonna try it out... thanks again
  01 January 2006
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 02:53 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.