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 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. Thanks, cheers. Jeremy _______________________________________________ Geometry mailing list [hidden email] http://lists.boost.org/mailman/listinfo.cgi/geometry |
Hi Jeremy, You should look at some basic linear algebra. There are a number of ways to derive the formula and each source covers this from a slightly different angle (no pun intended :)); try to understand geometric meaning of the line equation (of the form a*t + b) and the dot product (a dot b). Drop me an email if you are struggling with this. Greets, mike On 2 August 2016 at 08:27, Jeremy Murphy <[hidden email]> wrote:
_______________________________________________ Geometry mailing list [hidden email] http://lists.boost.org/mailman/listinfo.cgi/geometry |
In reply to this post by Jeremy Murphy
Hi Jeremy,
Jeremy Murphy wrote:
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: https://github.com/boostorg/geometry/blob/develop/include/boost/geometry/strategies/cartesian/distance_projected_point.hpp#L119 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 mailing list [hidden email] http://lists.boost.org/mailman/listinfo.cgi/geometry |
Free forum by Nabble | Edit this page |