Angle2 Problem

Hello ,

I came across this problem, I am using Angle2 to check the angle between two lines,the two blue lines are on the same plane, the same direction and the same angle, but for whatever reason the command Angle2 does not return 0.0, as well as the black lines, is something missing?

Angle problem.3dm (28.8 KB)

import rhinoscriptsyntax as rs

line = rs.GetObject(“line”);
line2 = rs.GetObject(“line2”);

point1 = rs.CurveStartPoint(line);
point2 = rs.CurveEndPoint(line);

point3 = rs.CurveStartPoint(line2);
point4 = rs.CurveEndPoint(line2);

angle = rs.Angle2( (point1, point2), (point3, point4))
print angle[0]

What is the problem??

Hi Matrix,

Take tolerance into consideration. ‘8.53773646252e-07’ is much less than any Rhino Model tolerance.

import rhinoscriptsyntax as rs
import Rhino

tol = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance

line = rs.GetObject("line");
line2 = rs.GetObject("line2");

point1 = rs.CurveStartPoint(line);
point2 = rs.CurveEndPoint(line);

point3 = rs.CurveStartPoint(line2);
point4 = rs.CurveEndPoint(line2);

angle = rs.Angle2( (point1, point2), (point3, point4))
angleD = angle[0]

if angleD < tol:
    angleD = 0
print "angleD: ", angleD   # prints "0"

Thank you @djordje