Sam Jones Posted November 8, 2020 Share Posted November 8, 2020 Is there a function or an algorithm that will yield the coordinates of a point along a 3D polyline at a specified distance from the start? Something like the PointAlongPoly() function. That function does not seem to yield a location even though a vector is one of its parameters. Quote Link to comment

Julian Carr Posted November 8, 2020 Share Posted November 8, 2020 If you convert the 3D poly to a NURBs curve using ConvertToNURBS() then you should be able to use one of the NURBs calls like NurbsCurveEvalPt(). 1 Quote Link to comment

Pat Stanford Posted November 9, 2020 Share Posted November 9, 2020 Or if you want to keep it as a Poly, Convert a copy to Nurbs, find the point, then delete the Nurbs. Or walk the vertices summing the distance. When the distance is greater than your distance you know you have gone one vertex too far. Step back and calculate the remaining distance as your total distance minus the pervious vertex. Use that last vertex and the next vertex to get the unit vector of the edge and the remaining distance to find the point of the distance. Not especially clear, but it should be a pretty short subroutine. Let me know if you need more help. Quote Link to comment

Sam Jones Posted November 9, 2020 Author Share Posted November 9, 2020 Unfortunately, I need to find the coordinates of the point on the 3D poly that is usually between vertices. Stepping through the vertices is something I do all the time, but doing the vector math to find the coordinate between vertices is new to me. My presumptions upon Raymond have been embarrassingly often. Your turn? You allude to UnitVec() being what I need. So, I get the location and distance of the 2 - 3D vertices that book end the desired distance along the poly. how do I get the coordinates of the point some specified distance between Julian, I will be looking at the NURBS functions, but I have some UI concerns with converting paths to NURBS. The create, compute, delete method that Pat mentions might work, but I have some similar UI concerns. Will see. I need yet another vector math lesson regardless. The language of vectors, use it or lose it. A shout out to Raymond Mullins who has provided me with numerous solutions and examples, and every time I come up with another obvious vector problem I am embarrassed that I cannot coax the answer I need out of one of them. His Reshaper tool does wonderful things manipulating text not just geometric objects. Quote Link to comment

Pat Stanford Posted November 9, 2020 Share Posted November 9, 2020 Hi Sam, No time for demo code until at least tonight, but here is the basics. Given the two points on each end of the segment, (P1,P2) you can calculate the vector between them by: V1=P2-P1; Convert that to a UnitVector by: V2:=UnitVec(V1); Get the Vector to the point you want by multiplying by the distance you want to go along the vector. V3:=V2 * RemainingDistance; Find the point by adding the vector to the point of the vertex. P3:=P1 + V3; HTH Quote Link to comment

MullinRJ Posted November 12, 2020 Share Posted November 12, 2020 Hi Sam, What Pat said. If you still need to call, please feel free at any time. Raymond Quote Link to comment

Pat Stanford Posted November 12, 2020 Share Posted November 12, 2020 I thought I had posted the sample code the other day, but it is not here. :-( This code places a 3D loci at the point 4' (a literal constant in the V3= line of the code) along the first segment of a 3D poly. Extrapolate to use the point before and after your overall length and you should be good to go. Procedure PtAlong3DPoly; Var P1,P2,P3, V1,V2,V3: Vector; X1,Y1,Z1, R1: Real; H1: Handle; Begin H1:=FSActLayer; GetPolyPt3D(H1,1,P1.X,P1.Y,P1.Z); GetPolyPt3D(H1,2,P2.X,P2.Y,P2.Z); V1:=P2-P1; V2:=UnitVec(V1); V3:=V2*4'; P2:=P1+V3; Locus3D(P2.X, P2.Y, P2.Z); End; Run(PtAlong3DPoly); Quote Link to comment

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Note:Your post will require moderator approval before it will be visible.