Dare I say, normalise isn’t giving me the results I expect…
I’ve set up a file with some meshes which each contain three points, the middle point is always on local (0,0,0).
Here’s the script which calculates the internal angle:
import bpy
import mathutils, math
print("
")
objs = bpy.context.selected_objects
o =objs[0]
v=o.data.vertices
v1=mathutils.Vector((v[0].co[0],v[0].co[1]))
v2=mathutils.Vector((v[2].co[0],v[2].co[1]))
v1.normalize()
print("v1n:",v1)
v2.normalize()
print("v2n:",v2)
v3 = v1.dot(v2)
a = math.acos(v3)
print("a:",a)
To recreate my issue, make a right angle with arms 1 unit in length, then using the origin for rotation rotate an arm 45 degrees. If you run the script it will print out “a: 0.7853979821219895”, which is 45 degrees.
Now if you duplicate this right angle object and then in edit mode select all and subdivide. Next delete the far points, so in effect you have two arms each of 0.5 units. If you now run the script, even though the angle is the same, I get “a: 1.3734007523747485”. :eek:
Why?
Cheers!