This topic contains the following sections.
VisionPro controls give you the option of displaying angle measurements in either degrees or radians. The underlying tools and operators, however, calculate angle measurements in radians, which are the units commonly used in computation.
As you work with VisionPro, you might need to perform conversions between these two systems of angular measure. For example, Visual Basic's Sin(), Cos(), and Tan() methods all expect angles in radians. Recall that the formula for converting between radians and degrees is:
360° = 2π rad
or
1 rad = 180° / π
To convert between radians and degrees in your Visual Studio.NET applications, use the RadToDeg method and DegToRad method of CogMisc. CogMisc is an application object: you can invoke its methods without creating an instance of it.
The following C# programming statements use the RadToDeg method.
using Cognex.VisionPro; using Cognex.VisionPro.Blob; private double valDegrees; private CogBlobResult myBlobResult; valDegrees = CogMisc.RadToDeg(myBlobResult.Angle);