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

    Getting Spline progress percent, given by point

    SDK Help
    0
    1
    156
    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
      Helper
      last edited by

      On 16/01/2014 at 20:58, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   13,14,15 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hi, I have a spline. It has, let us say, 500 points.
      This gives a step value of 1 / 500 = 0.002.

      So to find the position of a point 1/4 forward on the spline, I do

          Vector pointPos = splineData->GetSplinePoint(125 * step); 
      

      I now have the exact position of this particular point, and I can for example do

          	Matrix mMyObject = myObject->GetMg();
      	mMyObject.off = pointPos;
         	myObject->SetMg(mMyObject);
      

      And voila - myObject is positioned exactly at the point on the spline.
      Now, and here comes the challenge:
      I also have a SweepNurbs, which has the spline as property.

      Now, if I set the SweepNurb's End Growth to 25%, it does not match. The reason is probably that the points are not uniformly aligned along the spline. It does not help to change the spline in any way, from linear to bezier, or alter the uniform, subdivide etc properties. Is there a way to get the percentage by the index of the spline point?

      Look at this, you see that the cone is positioned at spline point 125, which is exactly 25 %. But when I set the end growth of the SweepNurbs to 25%, it is way beyond the cone.

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