Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 2233 by [email protected]: Triangle errors
http://code.google.com/p/sympy/issues/detail?id=2233
It is possible to create a Triangle from three collinear points.
In [1]: from sympy import *
In [2]: p1, p2, p3 = Point(0, 0), Point(1, 1), Point(2, 2)
In [3]: t = Triangle(p1, p2, p3)
In [4]: t.circumcenter
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
C:\Documents and Settings\gdk\My
Documents\computing\__git__\sympy\bin\<ipython
console> in <module>()
C:\Documents and Settings\gdk\My
Documents\computing\__git__\sympy\sympy\geometr
y\polygon.py in circumcenter(self)
854 """
855 a,b,c = [x.perpendicular_bisector() for x in self.sides]
--> 856 return GeometryEntity.do_intersection(a, b)[0]
857
858 @property
IndexError: list index out of range
This can be fixed by putting a check in __new__ which will raise an error
when the points are collinear.
Triangle.orthocenter raises an error
In [5]: p1, p2, p3 = Point(0, 0), Point(1, 1), Point(0, 2)
In [6]: t = Triangle(p1, p2, p3)
In [7]: t.orthocenter
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
C:\Documents and Settings\gdk\My
Documents\computing\__git__\sympy\bin\<ipython
console> in <module>()
C:\Documents and Settings\gdk\My
Documents\computing\__git__\sympy\sympy\geometr
y\polygon.py in orthocenter(self)
828 """
829 a = self.altitudes
--> 830 return GeometryEntity.intersect(a[1], a[2])[0]
831
832 @property
AttributeError: type object 'GeometryEntity' has no attribute 'intersect'
This looks easy to fix. GeometryEntity doesn't have an intersect method.
Fix this method call.
--
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.