pp_cfg
uses polar coordinates to determine where the "primary" and "directional"
symbols are located on a game piece.
They are also useful for drawing certain shapes and for making game diagrams on hex boards.
piecepackr
and grid
functions use angles in degrees
but the base
trigonometry functions usually use radians.
piecepackr
's 3D graphics functions save_piece_obj
, piece
, and piece3d
use the axis-angle representation for 3D rotations.
The axis-angle representation involves specifying a unit vector
indicating the direction of an axis of rotation and an angle describing the (counter-clockwise)
rotation around that axis. Because it is a unit vector one only needs to specify the first two elements,
axis_x
and axis_y
, and we are able to infer the 3rd element axis_z
. The default of
axis = 0
, axis_y = 0
, and implied axis_z = 1
corresponds to a rotation around the z-axis which is reverse-compatible
with the originally 2D angle
interpretation in grid.piece
. In order to figure out the appropriate
axis-angle representation parameters R_to_AA
, R_x
, R_y
, and R_z
allow one
to first come up with an appropriate (post-multiplied) 3D rotation matrix by chaining simple rotations
and then convert them to the corresponding axis-angle representation.
Pieces are rotated as if their center was at the origin.