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

    offset position between two points

    SDK Help
    0
    2
    198
    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 17/10/2013 at 12:52, xxxxxxxx wrote:

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

      ---------
      Hi,

      I am trying to get the position of a some points between two points. this is how I try to do it, but it doesn't work. somehow the direction is totally weird, as soon as p1Offset and p2Offset are changing:

        
      SplineObject* tempSpline = SplineObject::Alloc(pointCount,SPLINETYPE_LINEAR);
      Vector* tempPoints = tempSpline->GetPointW();
        
      for (int i=0;i<pointCount;i++)
      {
      Matrix dir= HPBToMatrix(VectorToHPB(p2-p1),ROTATIONORDER_DEFAULT);
      Vector perStep = (p2 - Vector(0,p2Offset,0) * dir - p1 + Vector(0,p1Offset,0) * dir) / pointCount;
      tempPoints[i] = p1 + Vector(0,p1offset,0) * dir + (i + 0.5) * perStep;
      }
      

      the simple distribution of the points between p1 and p2 work with no problem while p1Offset and p2Offset are zero. what i want to do is to be able to set a distance from p1 / p2 so the points distribute between those two offseted points.

      i am quite sure it has something to do with how i calculate the direction

      would be cool, if someone could have a look and tell me what I am doing wrong.

      cheers,
      Ello

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

        On 17/10/2013 at 14:40, xxxxxxxx wrote:

        ah, got it. i needed to place the offset to the z and not the y component of the vectors...

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