ortho static method

MatrixBase<MatrixBase, Vector3Base, QuaternionBase, Vector4Base> ortho(
  1. double left,
  2. double right,
  3. double bottom,
  4. double top,
  5. double nearPlane,
  6. double farPlane,
)

Returns an orthographic projection matrix defined by the given clip planes.

Implementation

static MatrixBase ortho(
  double left,
  double right,
  double bottom,
  double top,
  double nearPlane,
  double farPlane,
) {
  final result = zeroFactory();

  final rl = right - left;
  final tb = top - bottom;
  final fn = farPlane - nearPlane;

  result.m0 = 2.0/rl;
  result.m5 = 2.0/tb;
  result.m10 = -2.0/fn;
  result.m12 = -(left + right)/rl;
  result.m13 = -(top + bottom)/tb;
  result.m14 = -(farPlane + nearPlane)/fn;
  result.m15 = 1.0;

  return result;
}