Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5783

Performance of Rhino.Geometry.Surface.IsSphere(tolerance)

$
0
0

@spb wrote:

Is IsSphere supposed to work on non-rational NurbsSurfaces? If so, it is not returning True for some surfaces that are within tolerance. For example, for surfaces made by using _Rebuild on a Ø8.0 _Sphere, the method's threshold is between:

  • 79x79 and 80x80 CV's for 3x3 degree surfaces
  • 19x19 and 20x20 CV's for 5x5 degree surfaces

This can be verified using the following script on IsSphere.3dm (407.8 KB)

import rhinoscriptsyntax as rs

def main():
    
    idBrep = rs.GetObject("Select sphere", filter=rs.filter.surface, preselect=True)
    if idBrep is None: return
    
    rgFace = rs.coercesurface(idBrep)
    
    for e in range(-11, 1):
        tol = 10.**e
        if rgFace.IsSphere(tol):
            step = tol/100.
            for tol in rs.frange(tol/10.+step, tol+step, step):
                if rgFace.IsSphere(tol):
                    print "IsSphere returns True at a tolerance of {}.".format(tol)
                    return
    else:
        print "IsSphere returns False even at a tolerance of {}.".format(tol)

if __name__ == "__main__": main()

Thank you,
Steve

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5783

Trending Articles