Here is the function ported to C#, HTH

Includes some functions taken from the MgdDbg SLN by Jim Awe from AutoDesk.

Oops... forgot to include this:

`const Double pi = Math.PI;`

public static Double dVal = 0.2;

public static readonly Point3d kOrigin = new Point3d(0.0, 0.0, 0.0);

public static readonly Vector3d kXAxis = new Vector3d(1.0, 0.0, 0.0);

public static readonly Vector3d kYAxis = new Vector3d(0.0, 1.0, 0.0);

public static readonly Vector3d kZAxis = new Vector3d(0.0, 0.0, 1.0);

static Double delta(Double a1, Double a2)

{

Double ang;

if (a1 > a2 + pi)

ang = (a2 + pi + pi) - a1;

else if (a2 > a1 + pi)

ang = a2 - a1 - pi - pi;

else

ang = a2 - a1;

return ang;

}