Max Curvature Points precision error

Hello
I tried to convert @dale script to python, i am not sure if i 100% success because i don’t know how to run the original script.

To check if it work i check with Rhino6 and notice different results, sometimes with curves or when i use a very large scale ,and i try to solve that.
The first problem was with closed curve, Rhino6 curvature command find3 point where the script find 4 points if range(1000), but this make a problem with some opened curves and add extra point and i solve it by range(1,1000) , in this case i use this condition:

if curve.IsClosed == False:
        numbers = range(1,count)
    else:
        numbers = range(count)

    for i in numbers:
               ....................

image

and i increase points count by multiply with 100 for more precision result

count = nurb.Points.Count * 100

image

For the second problem with scale , with very large scale (1000000 for example) the script don’t find all points, i solve it by scale the input curve (something like unitize the vector) to find the points and the parameters than scale the curve to it’s original state and find the points with parameters list;
this work with all scales

Rhino max curvature points:

curves for test
curve.gh (5.4 KB)

Hi @seghierkhaled,

Since the code is already in C#, why wouldn’t you just use a C# script component?

test_min_max_radius_points.gh (3.3 KB)

– Dale

1 Like

Thanks Dale
because i want compile it to ghpy component and as i posted before there is a problem in the code with large scale and with closed curves.
This is a comparison between the c# code and the python code ( modified based on the c#)
scale: 30000

scale: 1, missing point

The missing point

scale: 300000 , many points missing

For this reason i use fixed scale (10) to find points than use their parameters to find max curvature points in the original curves (with large scale)