Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Global position of spline point

    Scheduled Pinned Locked Moved SDK Help
    7 Posts 0 Posters 718 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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();

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

                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. 🙂

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

                  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

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post