Hello, I have been using PostGis and Django Geos for a long time now, however today they both failed me. This prompted me to search and find sympy, so here I am.
I am trying to find the perpendicular distance from a Line to a Point. PostGis and Django Geos will only let me calculate the distance from a Point to a Line Segment i.e. the distance from the closest point on a Line Segment to a Point. I have tried the following in sympy but it is not returning what I expect. ----------------------------------------------------------------------------------------------------- from sympy.geometry import * l = Line(p1, p2) # My line is defined using two points. p = Point(x1, y1) # The point I wish to find the perpendicular distance to. # I expected the below to return a Line Segment connecting l and p, the length of this Line Segment being the distance I want. s = l.perpendicular_segment(p) distance = s.length However I am getting the below output. In [9]: l.perpendicular_segment(p) Out[9]: Point(Integer(123), Integer(123)) ----------------------------------------------------------------------------------------------------- What am I doing wrong? Kind regards, Cathal -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
