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 by 45 degrees around upVector to bring its left or right vertical edge to center.
  • Optionally rotate by arctan(1/sqrt(2)) ~ 35.264 degrees around rightVector to bring the top or bottom horizontal edge of the view to the center (for isometric views).

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)
  • STANDARD ISO VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitZ(), -1, 1)
  • STANDARD RIGHT ISO VIEW: createViewedAxes(Vector3d.unitX(), Vector3d.unitZ(), 1, 1)
  • Front, right, back, left, top, and bottom standard views are views from faces of the cube and iso and right iso standard views are views from corners of the cube.
  • Note: createViewedAxes is column-based so always returns local to world

createViewedAxes(rightVector: Vector3d, upVector: Vector3d, leftNoneRight: number0, topNoneBottom: number0): undefined | Matrix3d

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

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 upVector 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 rightVector 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: 14 November, 2024