Geometric Utilities

One group of functions enables applications to obtain geometric information. The acutDistance() function finds the distance between two points, acutAngle() finds the angle between a line and the X axis of the current UCS (in the XY plane), and acutPolar() finds a point by means of polar coordinates (relative to an initial point). Unlike most ObjectARX functions, these functions do not return a status value. The acdbInters() function finds the intersection of two lines; it returns RTNORM if it finds a point that matches the specification.

Note: Unlike acedOsnap(), the functions in this group simply calculate the point, line, or angle values, and do not actually query the current drawing.

The following sample code fragment shows some simple calls to the geometric utility functions.

ads_point pt1, pt2; 
ads_point base, endpt; 
ads_real rads, length; 
. 
.     // Initialize pt1 and pt2.
. 
// Return the angle in the XY plane of the current UCS, in radians.
rads = acutAngle(pt1, pt2); 
// Return distance in 3D space.
length = acutDistance(pt1, pt2);
base[X] = 1.0; base[Y] = 7.0; base[Z] = 0.0; 
acutPolar(base, rads, length, endpt); 

The call to acutPolar() sets endpt to a point that is the same distance from (1,7) as pt1 is from pt2, and that is at the same angle from the X axis as the angle between pt1 and pt2.