Revision: 35808
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 13, 2010 23:53 by ianbaldy
Initial Code
import math
import sys
class geometry:
def __init__(self):
self.name = ''
def curvature( self, list ):
if ( len( list ) < 3 ):
#Too few points
sys.exit( 0 )
return -1
else:
x1 = list[0][0]
y1 = list[0][1]
x2 = list[1][0]
y2 = list[1][1]
x3 = list[2][0]
y3 = list[2][1]
num = 2*((x2-x1)*(y3-y2)-(y2-y1)*(x3-x2));
den = math.sqrt( (math.pow((x2-x1),2) + math.pow((y2-y1),2)) * (math.pow((x3-x2),2)+math.pow((y3-y2),2 ))* (math.pow((x1-x3),2)+math.pow((y1-y3),2) ) );
if ( den == 0 ):
return 0
return num/den
Initial URL
Initial Description
Initial Title
Curvature of point set
Initial Tags
math, python
Initial Language
Python