solid.Shape

Methods

Method Reference: solid.Shape.rotate

solid.Shape: S = rotate (S, ANGLE, AXIS)

solid.Shape: S = rotate (S, ANGLE, AXIS, P)

Rotate a shape about an axis.

ANGLE is in degrees and turns the shape anticlockwise when seen from the tip of AXIS looking back, the right-hand rule. AXIS is a nonzero 3-element direction, and P a point on the axis, the origin by default.

To turn a shape in place, give its own centroid as P. The solids keep their colours.

 
 ## A pin standing along z, laid down along x
 [~, L] = bbox (rotate (solid.cylinder (2, 20), 90, [0, 1, 0]))
 ⇒ L = 20   4   4

 ## A block turned a quarter about its own centre
 S = solid.box (20, 10, 5);
 bbox (rotate (S, 90, [0, 0, 1], centroid (S)))
 ⇒ 5   -5   0   15   15   5

See also: solid.Shape.translate, solid.Shape.mirror, solid.Shape.scale

Source Code: solid.Shape