Bugs: Curve.GetNextDiscontinuity for G2

In 7.38, 8.35, and 9.0.26279.6303, 10/6/2026

Bugs:

  1. The non-overload GetNextDiscontinuity documentation does not state what values are used to determine the thresholds of G1 and G2 discontinuities, but the overload GetNextDiscontinuity documentation states they are

    cosAngleTolerance: cos(1 degree)
    curvatureTolerance: ON_SQRT_EPSILON (|K0 - K1| > curvature_tolerance)
    

    The reality is that
    cos(1 degree) is used for G1 <- Good
    but the thresholds for G2 are
    A. 2.0° <- Should be 1.0° (_GCon uses the same angle for both G1 and G2 thresholds, so correcting this will also make GetNextDiscontinuity more consistent with _GCon.)
    B. Relative difference in magnitude (RDM) of 5%,
    where RDM = abs(kB - kA) / max(kB, kA) <- Documentation should state that the relative difference of 5% is the default.

  2. Overload GetNextDiscontinuity bugs
    A. cosAngleTolerance:
    G1 results honor the argument.
    However for G2,
    Cos(0.0) <= cosAngleTolerance <= Cos(1.0): The threshold is actually for 2.0°.
    cosAngleTolerance=Cos(1.001 deg): Threshold at 2.002°
    cosAngleTolerance=Cos(7.494 deg): Threshold at 14.988°
    cosAngleTolerance >= ~Cos(7.495 deg): No G2 discontinuities are found.
    Fix would be for G2 to honor the argument value, like it already does for G1.
    B. 0.0 <= curvatureTolerance <= ADM (variable) (absolute difference in magnitude that results in 5% relative difference in magnitude)
    ADM < curvatureTolerance <= ?: absolute difference is honored
    ? < curvatureTolerance: No G2 discontinuities are found.
    Fix would be to change curvatureTolerance to be the relative difference in magnitude, and have it honor all values >= 0.

GetNextDiscontinuity G2 direction bug and comparing against _GCon

For_GetNextDiscontinuity_G2_direction.3dm (78.3 KB)

IronPython 2 script for GetNextDiscontinuity for provided .3dm
#! python 2 
from __future__ import absolute_import, division, print_function, unicode_literals

import Rhino
from System import Math


def main():
    
    res, objref = Rhino.Input.RhinoGet.GetOneObject(
        prompt="Select curve",
        acceptNothing=False,
        filter=Rhino.DocObjects.ObjectType.Curve)
    
    if res != Rhino.Commands.Result.Success: return
    
    crv = objref.Geometry()
    rv = crv.GetNextDiscontinuity(
        continuityType=Rhino.Geometry.Continuity.G2_continuous,
        t0=crv.Domain.T0,
        t1=crv.Domain.T1,
        cosAngleTolerance=Math.Cos(Rhino.RhinoMath.ToRadians(1.0)),
        curvatureTolerance=Rhino.RhinoMath.SqrtEpsilon)

    print(rv)


if __name__ == '__main__': main()

Then, _Explode the 4 curves into pairs and _GCon check the continuity of each pair.

Hi @spb,

I’m looking at this - I will clean up the comments.

Thanks,

– Dale