Global position of spline point



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

    On 12/08/2007 at 12:43, xxxxxxxx wrote:

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

    ---------
        Hi,

    I get the position of a point in a spline like this:

         SplineObject* PathSpline = static_cast<SplineObject*>(SC_SplineObj);  
         PathSpline->InitLength(0);  
         SC_Matrix_Base.off = PathSpline->GetSplinePoint(SC_SplinePos);
    

    (The object 'SC_SplineObj' is coming from the attributes of my expression tag. User links a spline object there. The value 'SC_SplinePos' is a Real between 0..1)

    When I use this code, I only get the local coordinates of the spline point. This means, when I rotate or move the spline object, I still get the same coordinates, which is bad.

    How can I get the global coordinates of the point?

    I thought about adding the global position of the spline object to the point coordinates, but that doesn't solve the problem of a rotated spline object.

    Thanks in advance for any helpful tips, hints and spanks on the forehead.

    Greetings,
    Jack



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

    On 12/08/2007 at 14:24, xxxxxxxx wrote:

    You need to multiply the point with the global matrix of the spline: PathSpline->GetSplinePoint(SC_SplinePos)*PathSpline->GetMg();



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

    On 12/08/2007 at 14:36, xxxxxxxx wrote:

    I can multiply a point (Vector) with a Matrix?
    I just thought I understood the rules of C++ ;-)
    Thanks, I'll try that!

    Greetings,
    Jack



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

    On 12/08/2007 at 14:55, xxxxxxxx wrote:

    Yeah, and it totally worked!
    Thanks again!

    Greetings,
    Jack



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

    On 12/08/2007 at 16:10, xxxxxxxx wrote:

    That's how one applies transformations to points, vectors, and vertices - by multiplying it by the matrix:

    vector' = vector * matrix

    That simple. :) The '*' is called an 'operator' in C++/Java. It associates a base operator to perform functions for the class that cannot be done with the operator generally - 'matrix + matrix' is meaningless since matrix is a class not a number, so you create a '+' operator and define the function that represents 'adding' two matrices, for instance. If you look at ge_matrix.h in the resource:_api folder you'll see the operators defined.



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

    On 13/08/2007 at 02:23, xxxxxxxx wrote:

    And as you were a COFFEE guy before, this is the same as GetMulP(). :)

    As Rob explained, actually you can multiply everything with anything if you define the according operator. :)



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

    On 15/08/2007 at 01:24, xxxxxxxx wrote:

    Seems, that is the cool thing as well as the confusing thing in C++... everything's possible.

    Thanks again.

    Greetings,
    Jack


Log in to reply