Tangential vectors for rotation controls



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/09/2006 at 23:59, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9.102 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Okay, I realize that this is going to be vague (elaboration can be furnished as we proceed). I have visual rotation controls similar to the standard Rotate tool in Cinema 4D R9. But I probably took a different road to implementation than the developers.

    It is understood that the hitpos for the control should be used (obj->GetMg() * res.hitpos) and that this in turn needs to be converted to a tangential vector to determine how mouse movements affect the rotation. I'm using the rotation center->hitpos as the radial vector and the rotation center->rotation axis as the axial vector. Cross-product and get the tangential vector.

    Well sort of. The problem is that it is an indiscriminant perpendicular to these two vectors. What is really needed is a tangential vector that represents the positive rotation direction. The perpendicular doesn't work as it always points in the same direction irregardless of rotation direction (clockwise/counter-clockwise) presented by the view.

    Any ideas on how to determine the positive tangential or adjust the perpendicular to be coincident with it?

    Thanks,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/09/2006 at 22:01, xxxxxxxx wrote:

    How about this (thinking upon this for a while)? I could get the positive rotation directions for C4D's left-handed coordinate system and start with a vector that is orthogonal and in the positive direction. Then rotate that vector to the 'hitpos'. I've read something about direction-cosine vectors in relation to tangential vectors, but nothing on this particular type of situation (typical).

    Understand that the mouse movement direction does work - its just opposite in certain orientations because I'm determining the perpendicular vector (from cross-product) from the axial and radial-hitpos vectors.

    Thoughts?

    Robert



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/09/2006 at 23:35, xxxxxxxx wrote:

    Still not getting this to work properly. The res.hitpos is for the untransformed control object (rotation axis would be y-axis when untransformed). Okay, that makes sense. So, I find the angle of the mouse hitpos from 0d using atan2 and compensate for the 180d to -180d range of atan2. Using the axis perpendicular to the 0d axis, I rotate a unit vector:

    // Work out screen direction vectors for optimum cursor affect  
    Matrix m = selectedBP->GetMg();  
    // Angle between ring's 0d axis and hit point on ring  
    Real angle = atan2(xHitPos.x,xHitPos.z);  
    if (angle < 0) angle =     RAD_360+angle;  
    Vector     off =      bd->WS(Vector(0.0,-1.0,0.0)*(m*MatrixRotX(angle))) - bd->WS(m.off);
    

    This is for a constrained X-Axis rotation. To some extent it works, but under certain viewing orientations, the results are opposite (the mouse moves one way and the rotation goes the other way).

    Remember that I can't use Arcball rotation. What is needed is a positive rotation tangential direction vector projected to the screen in order to determine how the mouse affects the constrained rotation.

    Visualizing this is proving difficult (and visualizing it by drawing to the display is not so easy either).

    Thanks,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 30/09/2006 at 00:43, xxxxxxxx wrote:

    I've found that SGI's Invertor Toolkit has the same functionality as Cinema 4D R9 for interactive constrained-axis rotation (Michael Chen: Silicon Graphics' Inventor Toolkit contains a version with three orthogonal "ribbons" around the sphere to provide constrained-axis rotation.) Maybe this will help (OGL or not)?

    Thanks,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 01/10/2006 at 10:04, xxxxxxxx wrote:

    It's now working. :)

    Thanks,


Log in to reply