Comment #4 on issue 2117 by smichr: Distance between polygons
http://code.google.com/p/sympy/issues/detail?id=2117
There is nothing prebuilt that I know of but a rectangle is a polygon and
vertices of polygons can be enumerated and segments have a length attribute
so you can find out the length between a rectangle's vertices and any given
point:
>>> r = Polygon(Point(0,0), Point(10,0), Point(10,5), Point(0,5))
>>> for v in r.vertices:
... print Segment(v, Point(1,1)).length
...
2**(1/2)
82**(1/2)
97**(1/2)
17**(1/2)
Just watch out for trying to define a segment where the two points are the
same as that will raise an error, i.e. Segment(v, v) raises an error.
BTW, a good place to raise these sorts of questions about functionality is
on the discussion list: http://groups.google.com/group/sympy
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" 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-issues?hl=en.