[PD] Find distance to a line in 3d space

Claude Heiland-Allen claude at mathr.co.uk
Fri Dec 6 00:51:42 CET 2013


On 05/12/13 23:40, João Pais wrote:
> Hello list,
>
> I had a doubt, will try to explain.
>
> I wanted to define a line in a 3d space through 2 points, and be able to
> find out the distance from another point to that line. Since I'm very
> bad at math, I wanted to know if anyone has done something similar, or
> knows how to get to it.

http://paulbourke.net/geometry/pointlineplane/

first example on the page, you just need to clamp u to [0..1] if you 
want to make it work for a line segment instead of an infinite line.


Claude

> As I see it, the process goes this way:
> - define a line from coordinates x1,y1,z1 to x2,y2,z2
> - declare the point x3,y3,z3
> - find the distance from that point to the nearest point belonging to
> the said line
>
>
> Any existing examples with gem rendering would be great.
>
> Thanks as usual,
>
> jmmmp

-- 
http://mathr.co.uk




More information about the Pd-list mailing list