Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
609 views
in Technique[技术] by (71.8m points)

wpf - Finding coordinates of a point between two points?

Doing some 3D stuff in wpf- want to use a simpler test to see if everything is working (before moving to curves).

The basic question is given two points x1,y1,z1 and x2,y2,z2 I have calculated the distance between the points. But how to find the coordinates of another point (x3,y3,z3) that lies on that line at some distance?

I.e. if my line is 100 long between -50,0,0 and 50,0,0 what are the coordinates of the point at 100 * 0.1 along the line?

I think this is a simple formula but I haven't found it yet....

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For each p between 0 and 1 then this will give you a point on the line segment:

(x1, y1, z1) + p * ((x2, y2, z2) - (x1, y1, z1))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...