我的代码
public static bool IsParallel(Curve c1, Curve c2, bool hasDirection = false, double tol = Tolerance)
{
if (c1 is Line && c2 is Line) {
Line l1 = c1 as Line;
Line l2 = c2 as Line;
return hasDirection? l1.Direction.IsEqualNew(l2.Direction, tol):(l1.Direction.IsEqualNew(l2.Direction, tol) || l1.Direction.IsEqualNew(-l2.Direction, tol));
}else if(c1 is Arc && c2 is Arc) {
Arc arc1 = c1 as Arc;
Arc arc2 = c2 as Arc;
return arc1.Center.DistanceTo(arc2.Center) < Precision;
}
return false;
}