Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pipe



Hi,
I have to build a pipeline on a Bezier path. My profile is a circle.
For each point of the Bezier curve I have the tangent normalized vector.
I will draw the pipeline with GL_QUAD_STRIP.
So e.g. for each point "i" of the curve, to calculate the vertexes of one
circle (which can be rotated anyway on the 3 axes), I iterate from 0 to 360
degrees and get 
    

    bP[0] = mPath[i][0];        // the point on the bezier path
    bP[1] = mPath[i][1];
    bP[2] = mPath[i][2];

    bT[0] = mTangent[i][0];     // the tangent on the bezier path
    bT[1] = mTangent[i][1];
    bT[2] = mTangent[i][2];

    for(slice = 0; slice <= mSlices; slice++){
        radAngle = (angle * slice);

        circleP[0] = 0.0; // bP[0];
        circleP[1] = sin(radAngle) * radius;
        circleP[2] = cos(radAngle) * radius;

        // So now, how to rotate this point according to the
        // tangent "bT" ?

    }

I have already built my 4 x 4 rotation matrix but since it requires the 3
rotation angles, I am forced to calculate them with e.g.
    angleY = atan2(-bT[2], bT[0]),
and as you know in case of bT[0] = 0 or bT[2] = 0 I get wrong values. Is any
other simpler way to do it using only the tangent values?
Is other function working better than atan2?


Best Regards
-- 
Lorenzo
email: email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.