suppose i have a face normal info vector array? and i want this to be
expressed as a euler rotation ? any clues ? ? ? essentially i need a
torus to be in parallel to another face ? am i being a moron ? i m
sure i am and i bet there is a very simple method but i m just messing
around with a script i found but it does nt seem to be in the right
ball park. This is MEL but i ve written the python wrapper ....


vector $up = <<0.5  , 0.5   ,  0.5>>;
  vector $direction =  <<$x, $y , $z >> ;


    // calculate the side vector
    vector $sideVec = cross( $up, $direction );
    vector $upVec   = cross( $direction, $sideVec );

    float $cosY = sqrt( ($sideVec.x)*($sideVec.x) + ($sideVec.y)*
($sideVec.y) );

    // solve each angle
    float $rotZ = atan2( ($sideVec.y), ($sideVec.x) );
    float $rotY = atan2( -($sideVec.z), ( (($sideVec.x)+
($sideVec.y)) / (cos( $rotZ ) + sin( $rotZ ) ) ) );
    float $rotX = atan2( ($upVec.z), ($direction.z) );

    // convert to degrees
    $rotX = rad_to_deg( $rotX );
    $rotY = rad_to_deg( $rotY );
    $rotZ = rad_to_deg( $rotZ );

    // return x,y,z rotations
    print $rotX; print "  ";
    print $rotY; print "  ";
    print $rotZ;


i m pretty sure i m not giving it the right inputs but what does it
want !?!?! Any help would be greatly appreciated ?
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to