Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def angle(self, o, p1, p2):
- '''the angle between two points around origin (never used origin)
- eq= len(op1)**2 + len(op2)**2 - len(p1p2)**2 over
- / 2*len(op1)*len(op2) '''
- ##norm both points
- #p1 = self.normalize(p1)
- #p2 = self.normalize(p2)
- #lengths of both points from origin
- a = self.distance(o, p1)
- b = self.distance(o, p2)
- c = self.distance(p1, p2)
- print 'distance of a, b, c:', a, b, c
- #main equation
- cosC = (a ** 2 + b ** 2 - c ** 2) / (2 * a * b)
- print 'result of equation', cosC
- ##solve cos with var cosC
- #Ccos = math.cos(cosC)
- #print 'used equations result and cosd it', Ccos
- C = math.acos(cosC)
- print 'angle between the two points in relation to origin in rads', C
- degC = math.degrees(C)
- print 'C in degrees', degC
- return degC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement