createViewedAxes MethodStatic

Create a matrix from "as viewed" right and up vectors.

  • ColumnX points in the rightVector direction
  • ColumnY points in the upVector direction
  • ColumnZ is a unit cross product of ColumnX and ColumnY.
  • Optionally rotate the standard cube by 45 degrees ccw around Y to bring its left or right vertical edge to center.
  • Optionally rotate the standard cube by 35.264 degrees ccw around X (isometric rotation).
  • This is expected to be used with various principal unit vectors that are perpendicular to each other.
  • STANDARD TOP VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitY(), 0, 0)
  • STANDARD FRONT VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitZ(), 0, 0)
  • STANDARD BACK VIEW: createViewedAxes(Vector3d.unitX(-1), Vector3d.unitZ(), 0, 0)
  • STANDARD RIGHT VIEW: createViewedAxes(Vector3d.unitY(), Vector3d.unitZ(), 0, 0)
  • STANDARD LEFT VIEW: createViewedAxes(Vector3d.unitY(-1), Vector3d.unitZ(), 0, 0)
  • STANDARD BOTTOM VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitY(-1), 0, 0)
  • Note: createViewedAxes is column-based so always returns local to world

createViewedAxes(rightVector: Vector3d, upVector: Vector3d, leftNoneRight: number = 0, topNoneBottom: number = 0): undefined | Matrix3d

Parameter Type Description
rightVector Vector3d ColumnX of the returned matrix. Expected to be perpendicular to upVector.
upVector Vector3d ColumnY of the returned matrix. Expected to be perpendicular to rightVector.
leftNoneRight number Specifies the ccw rotation around Y axis. Normally one of "-1", "0", and "1", where
"-1" indicates rotation by 45 degrees to bring the left vertical edge to center, "0" means no rotation,
and "1" indicates rotation by 45 degrees to bring the right vertical edge to center. Other numbers are
used as multiplier for this 45 degree rotation.
topNoneBottom number Specifies the ccw rotation around X axis. Normally one of "-1", "0", and "1", where
"-1" indicates isometric rotation (35.264 degrees) to bring the bottom upward, "0" means no rotation,
and "1" indicates isometric rotation (35.264 degrees) to bring the top downward. Other numbers are
used as multiplier for the 35.264 degree rotation.

Returns - undefined | Matrix3d

matrix = [rightVector, upVector, rightVector cross upVector] with the applied rotations specified by leftNoneRight and topNoneBottom. Returns undefined if rightVector and upVector are parallel.

Defined in

Last Updated: 30 November, 2023