Developer: openNURBS
Summary: Discusses non-uniform scaling issues when using the openNURBS toolkit.
In Rhino, I can insert an instance of a block and give it a non-uniform scale (transformation). But, when I read the model, using the openNURBS toolkit, and try to “explode” the block into its geometric form, the geometry is no longer non-uniformly scaled.
Not all ON_Geometry-derived classes can be can be accurately modified with “squishy” transformations like projections, shears, an non-uniform scaling. For example, if you were to apply a non-uniform scale to a circle, which is represented by an ON_ArcCurve curve, the resulting geometry is no longer a circle.
When exploding an instance reference into its geometric form, you will want to first test to see if the the instance reference's transformation is a similarity transformation. This can be done by using ON_XForm::IsSimilarity(). See opennurbs_xform.h for more information.
If the transformation is not a similarity, then you should convert the geometry into a form that can be accurately modified. This can be done by using the ON_Geometry::MakeDeformable() override on the geometric object.
For example:
if( bNeedXform ) { // If not a similarity transformation, make sure geometry // can be deformed. Generally, this involves convert non-NURBS // geometry into NURBS geometry. if( 0 == xform.IsSimilarity() ) geom->MakeDeformable(); // Do the transformation geom->Transform( xform ); }
Download openNURBS sample code