Closed wortmann closed 12 years ago
I'm pretty sure the number you are passing to RhinoMath.ToDegrees is already NaN https://github.com/mcneel/rhinocommon/blob/master/dotnet/opennurbs/opennurbs_defines.cs#L98 ToDegrees just multiplies the input number by the constant of 180.0 / PI
Break your code up into multiple lines and you should be able to track down the root of the problem. I suspect that your vectors may be InValid
double angle = RhinoMath.ToDegrees(Math.Acos(Multiply(vec2D.Unify(vec1), vec2D.Unify(vec2))));
I have noticed that in above code sample, ToDegrees sometimes returns NaN ("not a number"). I think this is the case when the angle is super tiny, so it might be better to return 0 instead. I might also be a problem with Math.Acos, but that seems unlikely.