Version 0.59.0

scaling

Constructor of a scaling transformation of type atrafo.

Signatures

  •   scaling( float scale )
  •   scaling( float scaleX, float scaleY, float scaleZ )
  •   scaling( vector onset, float scale )
  •   scaling( vector onset, float scaleX, float scaleY, float scaleZ )

Details

The scaling transformation allows for changing the size of an object in one or more dimensions. Uniform scaling changes the size of the object equally in all directions, while non-uniform scaling can stretch or compress the object along the specified axes.

The first form of the constructor uniformly scales the object by the given factor in all directions. The second form allows for specifying different scaling factors for each axis, enabling non-uniform scaling. The third and fourth forms allow for scaling with respect to a point other than the origin, specified by the onset vector.

Negative scaling factors can be used to mirror the object along the corresponding axes.

Example

 make scaling( 2.0 ) >> box()
 

Applies a uniform scaling factor of 2 to a box, doubling its size in all dimensions.

Example

 make scaling( 1.0, 2.0, 0.5 ) >> box()
 

Applies a non-uniform scaling to a box, leaving the X dimension unchanged, doubling the size in the Y dimension, and halving it in the Z dimension.

Example

 make scaling( <[ 1.0, 1.0, 1.0 ]>, -1.0, 1.0, 1.0 ) >> mesh("bunny.stl")
 

Mirrors the Stanford bunny model along the X-axis about the point (1, 1, 1).

Illustration of uniform scaling (left) and non-uniform scaling (right) of a cube.

Illustration of the Stanford bunny and its mirrored version.

Note

Scaling transformations are applied with respect to the coordinate system origin by default. To scale around a different point, use the onset vector in the constructor.

Parameters

scale

The uniform scaling factor.

scaleX

The scaling factor along the X-axis.

scaleY

The scaling factor along the Y-axis.

scaleZ

The scaling factor along the Z-axis.

onset

A vector representing the fixed point around which scaling occurs.

See also

🗙

Search results for