Change the pivot of transfromation of a curve

ON curves provide a function to transform the curve, using ON_Xform. By default, a curve’s transformation pivot is at {0,0,0}, regardless of where the control curve points are located in the world space. For example, the curve in the screenshot is located at the origin {0,0,0}, but the curve points (red dots) are positioned somewhere else.

Therefore, when the curve is translated, it is translated from the original pivot at {0,0,0}.

Is there a way to reset the pivot of the curve, or any other object for that matter, to a new ON_3dPoint so that the transformations (move, rotate, scale) can be performed from that pivot instead of the original pivot?

Hi Constantinos,

I’m not an OpenNURBS expert but, informed by the ‘Multiple Transformations’ tutorial in ‘The Essential Mathematics’ by Rajaa Issa (see Rajaa | Rhino3D.Education) I think you need to translate the curve, moving the desired pivot point to the origin, perform the rotation, then translate the rotated curve back with the reverse of the initial translation. Creating a combined transformation should be more efficient than applying the transformations separately.

HTH
Jeremy

Thank you for your suggestion Jeremy. Indeed the process is to bring the object to the origin, perform the related transformations and move back to position. I am aware of the math behind that method, but I what I was looking for is a function in OpenNurbs that can allow me to set the location of the pivot for the transformations of the curve, or any other object, for convenience. :slight_smile: I would expect such a function to reside in ON_Xform.

Hi @Constantinos_Glynos,

I am not sure I understand this statement - perhaps you can clairfy?

OpenNURBS geometry doesn’t have a “pivot” location. All geometry is represented in World XY coordinates.

Perhaps you can explain what you are trying to do, and why?

Thanks,

– Dale

Hi Dale,

ON includes functions such as Translate, Rotate, Scale and a Transformation function that accepts a 4x4 matrix. These transformations are applied to the object, mesh, curve, etc. The pivot of transformation is, by default, the origin. For example, if you create a curve with curve points that are far from the origin and try to scale that curve, you will see that the curve scales with respect to the origin, i.e. scaled but also moved closer to the origin. Setting a pivot will enable users to perform transformations on objects with respect to the new pivot of transformation.

Use this:

ON_Xform::DiagonalTransformation

– Dale

What is ON_Xform::DiagonalTransformation? The documentation is absent.

@Constantinos_Glynos - openNURBS is open source.

– Dale