offset position between two points

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

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