Changeset 2710
 Timestamp:
 Apr 12, 2006, 3:07:18 PM (19 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

inundation/utilities/numerical_tools.py
r2709 r2710 41 41 # Compute angle 42 42 p = innerproduct(v1, v2) 43 c = crossproduct_length(v1, v2) 43 c = innerproduct(v1, normal_vector(v2)) # Projection onto normal 44 # (negative cross product) 44 45 45 46 theta = acos(p) … … 48 49 # If v2 was the unit vector [1,0] this would correspond to the test 49 50 # if v1[1] < 0: theta = 2*pitheta 50 # In general we use the sign of the cross product length51 if c >0:51 # In general we use the sign of the projection onto the normal. 52 if c < 0: 52 53 #Quadrant 3 or 4 53 54 theta = 2*pitheta … … 82 83 83 84 84 def crossproduct_length(v1, v2):85 return v1[0]*v2[1]v2[0]*v1[1]85 #def crossproduct_length(v1, v2): 86 # return v1[0]*v2[1]v2[0]*v1[1] 86 87 87 88
Note: See TracChangeset
for help on using the changeset viewer.