Synopsis
PDX_MSGT mth_SweepAnglesLoop(long option, int dim, int num_segs, int *num_seg_pnts, long num_pnts, double *pnts, double tol, int *num_angle_ranges, double **angle_ranges, PDX_BOOL *axis_touch)
Purpose
Find the sweeping angles of a closed loop about Z axis
Description
The sweeping angles of a set of continuous points that are obtained from a set of continuous curves with a reasonable tight approximation tolerance, precisely, the sweeping angle of every two consecutive points about Z axis should be smaller than 180 degrees, will be computed in function. The end angle is not smaller than the start angle which is within [- MTH_ANG_EPS, MTH_2_PI - MTH_ANG_EPS).
The loop represented by these points must be continuous. If the Z axis or origin is not inside of the loop, only a pair of angles will be returned; otherwise, a pair of angles will be found for each segment or curve. The users might need to merge the results as needed.
Though only 2D data will be used, for convenience, the input can be either 2D or 3D points.
For some data, the angle ranges can not be determined. Specifically, when all or some of the points are near the origin. When such cases occur, num_angle_ranges will be returned as zero.
Input
option
Options (not used)
dim
The dimension of points (2 or 3)
num_segs
The number of segments/curves in the loop
num_seg_pnts
The numbers of points in each segment [num_segs]
num_pnts
The number of points
pnts
The points array [(2 or 3)*num_pnts]
tol
The tolerance for checking if a point is at the origin
Output
num_angle_ranges
The number of sweeping areas for the loop = 0, Sweep angles could not be determined >= 1, Sweep angles were determined.
angle_ranges
The sweeping angles for all areas, each pair of values represent an area and the starting angle is not larger than the ending angle [2*num_angle_ranges]
axis_touch
Flag indicating if the loop touches the axis
Return
MTH_NOERR
MTH_ORIGIN_POINT
Low level error return
.fi