Hey everyone, i was trying to use the MaxCurvaturePoints() method from Curve to get a continuous analysis of the curvature of a curve (I assumed it would be continuous since there is no tolerance parameter or similar to input).

However it seems like the analysis is not discrete, since by using this code with a low enough tolerance (0.00001 for example), the point is elsewhere. This other point also matches the peak on the CurvatureGraph of the curve.

double maxCurvature = 0;
Point3d maxCurvaturePoint = Point3d.Unset;
for (double t = 0.0; t <= 1.0; t += ttol)
{
Point3d point = curve.PointAt(t);
double curvature = curve.CurvatureAt(t).Length;
if (curvature > maxCurvature)
{
maxCurvature = curvature;
maxCurvaturePoint = point;
}
}
A = maxCurvaturePoint;

Could anyone please clarify if MaxCurvaturePoints is indeed doing a continuous or discrete analysis?
Thanks in advance!

I do not have knowledge of the actual code. But I do know a bit about the math involved and the implicaitons on how the max curvature points need to be calculated.

Ultimately all calculations on a digital computer are discrete with finite precision. (Integer calculations on a digital computer are discrete but exact. However all calculations of NURBS curves in Rhino use floating point math.)

Some quantities such as the length of a line or the curvature of a NURBS curve can be calculated directly.

Some quantities such as the length of a NURBS curve are calculated by sampling the input geometry at numerous points, and then using the results of the samples in further calculations.

Some quantities are calculated by iteration using a quantity which can be calculated, with the results of one step used to refine the calculations of the next step.

While it is possible to directly calculate the curvature of NURBS curve at a specified location on the curve, it is not possible to directly calculate the location of points of maximum curvature of a general NURBS curve. In other words there is no formula into which the curve coefficients (knot list, control point coordinates) can be inserted and the location of the maximum curvature is the direct result.

One simplistic algorithm for determining the locations of maxium curvature would be to sample (calculate) the curvature at many points along the curve, and then sort through the resulting values to find the ones which are larger than their neighbors. I doubt this is how the MaxCurvaturePoints method works in Rhino but it might.

More likely is the MaxCurvaturePoints method uses an iterative algorithm which involves repeated calculations. The results of one iteration are used to refine the choice of input for the next iteration. The calcuations continue until some measure is less than a desired threshold (or until the calculations determine the desired result does not exist). There are numerous different algorithms. For determining the maximum curvature the calculations may involve the curvature and/or the rate of change of curvature.