For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Can I do non uniform scaling ?

Anonymous's picture
Forums: 

Hi !

gp_Trsf only support uniform scaling, can I do non uniform scaling of a TopoDS_Shape object ?

For example if I would like to make an ellipsoid out of a sphere or something like that ?

Mikael

Arnaud Magnier's picture

Mikael,

There are two key classes to define a non-uniform transformation on a shape. These are:

- Class gp_GTrsf to define the transformation by itself.

- Class BRepBuilderAPI_GTransform to modify your shape by applying the transformation.

Hoping this will help you, regards,

Arnaud.

Mikael Aronsson's picture

Hi !

Thanks for the tip, that works, this is bit messy to use though, I have to setup the matrix myself or setup a gp_Trsf object and then copy that to a gp_GTrsf it would be nice to have the setScale(), setRotation(), setTranslation(), and a setScale( pnt, x, y, z) methods in the gp_GTrsf class and not just in the go_Trsf class.

Mikael

Thomas Moreau's picture

As Arnaud Magnier told you, you can define a 3D transformation by itself (with a 4-by-4 matrix).

And for non uniform scaling, you just have to use this matrix:

M= fx 0 0 0

0 fy 0 0

0 0 fz 0

0 0 0 0

where fx, fy, fz define scaling factor for every axis.

Regards, Thomas