Jump to content

Point along 3D Poly


Sam Jones

Recommended Posts

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.

Link to comment

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.

Link to comment

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

image.png

Link to comment

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

 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...