Getting face normal

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 02 February 2004   #1
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?

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

http://www.ewertb.com/maya/mel/mel.php?howto=05

Simon
__________________
http://www.rendermania.com/
 
Old 02 February 2004   #3
Thanks!

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
 
Old 01 January 2006   #4
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 03:44 PM.


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