Synopsis
PDX_BOOL mth_PointsDefineCircle(double pts[], long n, int nc, double pl_tol, double error_tol, double center[], double *radius, double normal[3])
Purpose
Check if set of points lies on a common circle
Description
This routine checks if a set of points lies on a circle. The points may be 2D or 3D. If the points all lie on a common circle, then the center, radius and normal to the circle are returned.
Input
pts
The set of points. pts is accessed as a 1D array. The points may have either 2 or 3 coordinates (see nc). The first coordinate of the second point is at pts[nc].
n
The number of points in pts. If n < 3, PDX_FALSE is returned.
nc
The number of coordinates per point.
pl_tol
Parallel line tolerance
error_tol
The function computes a number of candidate radii and compares them. If the deviation of the smallest radius from the largest radius is less than or equal to this tolerance, then PDX_TRUE is returned. Otherwise, PDX_FALSE is returned.
Output
center
Center of the circle (if PDX_TRUE is returned).
radius
Radius of the circle (if PDX_TRUE is returned).
normal
Unit normal vector to the plane of the circle (if PDX_TRUE is returned).
Return
PDX_TRUE if all points lie on a common circle; otherwise, PDX_FALSE