Commit 096df4a2 authored by sumpfralle's avatar sumpfralle

r576@erker: lars | 2010-02-04 23:43:38 +0100

 added function for calculating the "normal" vector of a triangle


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@99 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 37977680
...@@ -210,9 +210,11 @@ class Triangle: ...@@ -210,9 +210,11 @@ class Triangle:
self.calc_circumcircle() self.calc_circumcircle()
return self._radiussq return self._radiussq
def normal(self):
return self.p2.sub(self.p1).cross(self.p3.sub(self.p2))
def calc_circumcircle(self): def calc_circumcircle(self):
# we can't use the cached value of "normal", since we don't want the normalized value normal = self.normal()
normal = self.p2.sub(self.p1).cross(self.p3.sub(self.p2))
denom = normal.norm() denom = normal.norm()
self._radius = (self.p2.sub(self.p1).norm()*self.p3.sub(self.p2).norm()*self.p3.sub(self.p1).norm())/(2*denom) self._radius = (self.p2.sub(self.p1).norm()*self.p3.sub(self.p2).norm()*self.p3.sub(self.p1).norm())/(2*denom)
self._radiussq = self._radius*self._radius self._radiussq = self._radius*self._radius
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment