Inflection points with GhPython

Using curvature and intersection give close result but intersection always need to check the new curvature curve
The script created by @dale work fine but i don’t understand how to convert it to python looks like it use looping

If you’ve access to Rhino 7 WIP, you can use Curve.InflectionPoints and Curve.MaxCurvaturePoints like this:

Inflections = c.InflectionPoints()
MaxCurvature = c.MaxCurvaturePoints() (5.1 KB)

1 Like

Thanks , i see this in your post from other thread and it give the same result as @dale script.
There are different way with regular components but at the end all need intersection,
and it is for v6

There is a component from the old forum created by Walter Zesk
based on vb code of @DavidRutten

Which also available from archive web

give exactly the same result as script @dale

The explanation is not clear to me, can this done by regular components?

Update, after testing visual code with very small curve it fail

I try to convert c# code to python without success; i got null points

conversion c# (8.5 KB)

A new try, it give similar result but not the same 100%

points = []

def GetInflectionPoints(curve, points):
    if not curve: return
    nurb = curve.ToNurbsCurve()
    if not nurb: retrun
    on_zero_tolerance = 2.3283064365386962890625e-10
    count = nurb.Points.Count * 1000
    mul = 1.0 / count
    if nurb.Domain.Length > 1.0:
        epsilon = nurb.Domain.Length * on_zero_tolerance
    else: epsilon = nurb.Domain.Length
    t0 = 0.0
    k0 = Vector3d.Unset
    start_set = False
    for i in range(count):
        t1 = nurb.Domain.ParameterAt(i * mul)
        k1 = nurb.CurvatureAt(t1)
        if k1.IsValid:
            if k1.IsTiny():
            if start_set:
                t0 = t1
                k0 = k1
                start_set = true
            if k0 * k1 < 0.0:
                pt = Point3d.Unset
                t = (t0+t1)*0.5
                k = nurb.CurvatureAt(t)
                if k.IsValid:
                if k.IsTiny() and t1-t0<epsilon:
                if k*k0<0.0:
                        t1 = t
                        k1 = k
                if k*k1<0.0:
                        t0 = t
                        k0 = k
                pt = nurb.PointAt(t)
            k0 = k1
            t0 = t1
    if points.Count > 0:
        return points.pop(0)
if GetInflectionPoints(curve, points):
    a = points

Finally :slight_smile: