Synopsis

PDX_MSGT mth_SweepAnglesContPoints(long option, int dim, long num_pnts, double *pnts, double tol, int *num_angle_ranges, double **angle_ranges)

Purpose

Find the sweeping angles of a set of continuous points on XY plane

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).

If the curve represented by the points goes through the origin, two sweeping areas would be obtained using the points on both sides of the origin if the intersection is not at the ends of the curve. Certainly, more areas might be found if the curve goes through the origin multiple times.

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. Specifially, if all the points are around the origin. In this case, num_angle_ranges will be returned as zero.

Input

option

Options (not used)

dim

The dimension of points (2 or 3)

num_pnts

The number of points

pnts

The points array

tol

The tolerance for checking if a point is at the origin

Output

num_angle_ranges

The number of sweeping areas about Z axis = 0, Sweep angles could not be determined >= 1, Sweep angles were determined.

angle_ranges

The start and end angles of the sweeping areas about Z axis

Return

      MTH_NOERR
      MTH_ORIGIN_POINT
      Low level error return
      .fi