C++ Comparing Surfaces

Hey guys,

is there a way to compare two surfaces to be sure they match in terms of topology in the C++ API? I am working on a custom exporter and would like to automate the process of creating blocks. I am interested in doing that for the CRhinoSDKMeshObject, CRhinoSDKExtrusionObject and CRhinoSDKBrepObject.

Essentially what I am looking for is a hash which describes the object’s topology.

Thanks!

Hi Helge,

Use RhinoCompareGeometry. See rhinoSdkUtilities.h for details.

– Dale

Thanks Dale! Will give that a try!

Now that I think of it, this function may no be very helpful. It compares geometry to see if it is exactly the same. Generally, this can happen when an object is copied in place. Thus, for example, two boxes of identical size but in different locations will not be considered equal.

Indeed. Thanks anyway. I’ll implement a surface comparison myself then.

Hi @dale

Is RhinoCompare available in RhinoCommon (V6)? Cannot find it now.
I need to compare to Surfaces/Breps.
If not available - what can be used instead?

Thanks
Dmitriy

Yes, use Rhino.Geometry.Brep.IsDuplicate.

http://developer.rhino3d.com/api/RhinoCommonWin/html/M_Rhino_Geometry_Brep_IsDuplicate.htm

– Dale

Thanks, and what about comparison of curves?

The SDK does not have a geometric comparison for curves.

https://mcneel.myjetbrains.com/youtrack/issue/RH-38767

– Dale

Thank you @dale
I see you have asked it for other objects as well.
This is a great idea.

Would a possible workaround for this be a ‘remap’ of the object(s) of interest to a common coordinate system (e.g., orient object from UV vectors to XY plane), and then using the Brep.IsDuplicate command? I have recently tried this ‘remap’ method, however it would be nice if there was a tolerance that could be considered, as some geometries might be within tolerance of being duplicate (from a practical standpoint), but due to various modelling approaches (and or inherent Rhino tolerances), may not be identified as duplicates using the Brep.IsDuplicate approach.