VectorAngle() returns 0 instead of 90

Hi,

I don’t understand why VectorAngle returns 0 in this situation.
I’m trying to calculate the angle between U of the first surface and U of the second. Should be 90 degrees.

Maybe i’m doing something wrong? I attached the script and rhinofile.

Thank you!
vectorangle.3dm (78.0 KB) vectorangle.py (678 Bytes)

Hi Bogdan

SurfaceFrame () returns a plane, the return value is the same, so the angle of the vector is 0


You should use SurfaceEvaluate () function to get U, V vectors.

import rhinoscriptsyntax as rs

srf1 = rs.GetObject(message="Surface1", filter=8, preselect=True, select=False, custom_filter=None, subobjects=False)
srf2 = rs.GetObject(message="Surface2", filter=8, preselect=True, select=False, custom_filter=None, subobjects=False)

domainU = rs.SurfaceDomain(srf1, 0)
domainV = rs.SurfaceDomain(srf1, 1)

srfeval1 = rs.SurfaceEvaluate(srf1, [domainU[0], domainV[0]],1)

domainU = rs.SurfaceDomain(srf2, 0)
domainV = rs.SurfaceDomain(srf2, 1)



srfeval2 = rs.SurfaceEvaluate(srf2, [domainU[0], domainV[0]],1)


vecU = rs.VectorAngle(srfeval1[1],srfeval2[1])
vecV = rs.VectorAngle(srfeval1[2],srfeval2[2])


print vecU
print vecV
3 Likes

Thanks @603419608,

Now I understand!