@vertexvis/geometry 0.13.1 → 0.13.2-canary.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -424,6 +424,39 @@ function makePerspective(near, far, fovY, aspect) {
424
424
  var bottom = -ymax;
425
425
  return makeFrustum(left, right, top, bottom, near, far);
426
426
  }
427
+ /**
428
+ * Creates an orthographic projection matrix.
429
+ *
430
+ * Related to: gluOrtho. The viewing volume is cube-shaped and defined by
431
+ * the six parameters. The left and right values represent the coordinates of
432
+ * the vertical clipping planes, top and bottom values represent the coordinates
433
+ * of the horizontal clipping planes, and near and far values represent the
434
+ * coordinates of the depth clipping planes.
435
+ *
436
+ * @param left The coordinate of the left horizontal clipping plane.
437
+ * @param right The coordinate of the right horizontal clipping plane.
438
+ * @param bottom The coordinate of the bottom vertical clipping plane.
439
+ * @param top The coordinate of the top vertical clipping plane.
440
+ * @param near The coordinate of the near depth clipping plane.
441
+ * @param far The coordinate of the far depth clipping plane.
442
+ * @returns A matrix.
443
+ */
444
+ function makeOrthographic(left, right, bottom, top, near, far) {
445
+ var w = 1.0 / (right - left);
446
+ var h = 1.0 / (top - bottom);
447
+ var d = 1.0 / (far - near);
448
+ var x = (right + left) * w;
449
+ var y = (top + bottom) * h;
450
+ var z = (far + near) / d;
451
+ /* eslint-disable prettier/prettier */
452
+ return [
453
+ 2 * w, 0, 0, -x,
454
+ 0, 2 * h, 0, -y,
455
+ 0, 0, -2 * d, -z,
456
+ 0, 0, 0, 1
457
+ ];
458
+ /* eslint-enable prettier/prettier */
459
+ }
427
460
  /**
428
461
  * Matrix becomes a combination of an inverse translation and rotation.
429
462
  *
@@ -684,6 +717,7 @@ var matrix4 = /*#__PURE__*/Object.freeze({
684
717
  makeRotationAxis: makeRotationAxis,
685
718
  makeFrustum: makeFrustum,
686
719
  makePerspective: makePerspective,
720
+ makeOrthographic: makeOrthographic,
687
721
  makeLookAtView: makeLookAtView,
688
722
  makeLookAt: makeLookAt,
689
723
  invert: invert,