
Geometry : 
Subject: Re: [geometry] calculating the projection of a point on a line
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 20160803 10:19:42
Hi Jeremy,
Jeremy Murphy wrote:
> Dear Geometers,
>
> I have looked, but I cannot find an algorithm (in BG) to calculate the
> projection of a point on a line, as per the explanation here:
> http://cs.nyu.edu/~yap/classes/visual/03s/hw/h2/math.pdf
> <http://cs.nyu.edu/%7Eyap/classes/visual/03s/hw/h2/math.pdf>
>
> Have I simply missed it or is there a simple combination of algorithms
> to calculate it?
>
> So far I have been rolling my own linear algebra computation as per
> that paper, but I was hoping to simplify the code and use something
> built in.
There is no such algorithm in BG.
There are however tools allowing to do basic linear algebra computation
(using points as vectors). Actually what you'd like to do is implemented
as a part of projected_point distance strategy:
This strategy calculates the distance between a point and its projection
into a segment. So you could extract a part of the code from there.
You could also try to use Boost.QVM library newly added to Boost.
Regards,
Adam
Geometry list run by mateusz at loskot.net