[Numpy-discussion] point line distance

Sebastian Haase seb.haase at gmail.com
Thu Oct 7 03:32:33 EDT 2010


Hi,

in my Priithon project I the got from this
"""
    Minimum Distance between a Point and a Line
    Written by Paul Bourke,    October 1988
    http://astronomy.swin.edu.au/~pbourke/geometry/pointline/
"""
def geoPointLineDist(p, seg, testSegmentEnds=False)::
...

https://priithon.googlecode.com/hg/Priithon/usefulGeo.py

HTH,

Sebastian Haase


On Wed, Oct 6, 2010 at 11:13 PM, Ian Mallett <geometrian at gmail.com> wrote:
> Hi,
>
> A background in linear algebra helps.  I just came up with this method
> (which, because I thought of it 5 seconds ago, I don't know if it works):
>
> Line p1, p2
> Point v
>
> costheta = normalize(p2-p1) dot normalize(v-p1)
> dist = length(v-p1)*sin(acos(costheta)
>
> Ian
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>



More information about the NumPy-Discussion mailing list