ToArc or not ToArc

Hi,

I’m puzzled by the tolerance setting for Curve.IsArc()

A curve that test True for Curve.IsArc() but False for Curve.IsArc(0.1)
I would expect any tolerance to return True if a zero tolerance is True
Do I lack some fundamental knowledge on what this tolerance means or is this buggy behaviour?

find the curve in this file:
ToArc_or_not_ToArc.3dm (22.3 KB)

import rhinoscriptsyntax as rs
import scriptcontext as sc

def find_arc():
    
    objs = rs.NormalObjects()
    
    for id in rs.NormalObjects():
        curve = rs.coercecurve(id)
        if curve:
            
            print 'arc at tol:zero == {}'.format(curve.IsArc()   )
            print 'arc at tol:0.1 == {}' .format(curve.IsArc(0.1))

find_arc()

printout:
arc at tol:zero == True
arc at tol:0.1 == False

Thanks
-Willem

Hi @Willem,

The tolerance parameter is to determine whether or not the curve is planar within the specified tolerance. The tolerance is also used to test whether or not points along the curve are within tolerance of an arc fit thorough the curve.

Note, Curve.IsArc() uses the default tolerance of RhinoMath.ZeroTolerance, which is 1.0e-12.

– Dale

Hi Dale,

Thanks for your reply. However it does not explain for me why a lower tolerance finds an arc and a higher tolerance does not.
Would it not be so that if an Arc is found at a certain tolerance, all higher tolerances should also find an Arc.

-Willem

Hi @Willem.

At a tolerance of 0.1, the curve is linear within the tolerance.

Curve.ToArc performs a linear test to prevent creating arcs with small angles and large radii, and to prevent sloppy tolerances from classifying a span as an arc when it makes no sense.

– Dale

Hi Dale,

Thanks that makes sense. I’ll create a 2 step test to catch both small arcs with a low tolerance and larger ones with a higher tolerance.

-Willem