@vertexvis/geometry 0.21.1-testing.4 → 0.21.1-testing.6

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.
@@ -558,6 +558,32 @@ function makeLookAtView(position, lookAt, up) {
558
558
  ];
559
559
  /* eslint-enable prettier/prettier */
560
560
  }
561
+ /**
562
+ * Matrix becomes a combination of translation and rotation.
563
+ *
564
+ * Matrix becomes a combination of a translation to the position of 'eye' and a
565
+ * rotation matrix which orients an object to point towards 'center' along its
566
+ * z-axis. Use this function if you want an object to look at a point from
567
+ * another point in space.
568
+ *
569
+ * @param position The position of the object.
570
+ * @param lookAt The point which the object is looking at.
571
+ * @param up The direction which the object considers up.
572
+ * @returns A matrix.
573
+ */
574
+ function makeLookAt(position, lookAt, up) {
575
+ var z = normalize(subtract(position, lookAt));
576
+ var x = normalize(cross(up, z));
577
+ var y = cross(z, x);
578
+ /* eslint-disable prettier/prettier */
579
+ return [
580
+ x.x, x.y, x.z, 0,
581
+ y.x, y.y, y.z, 0,
582
+ z.x, z.y, z.z, 0,
583
+ position.x, position.y, position.z, 1
584
+ ];
585
+ /* eslint-enable prettier/prettier */
586
+ }
561
587
  /**
562
588
  * Returns the inverse of the given matrix. If the determinate of the matrix is
563
589
  * zero, then a zero matrix is returned.
@@ -766,6 +792,7 @@ var matrix4 = /*#__PURE__*/Object.freeze({
766
792
  makePerspective: makePerspective,
767
793
  makeOrthographic: makeOrthographic,
768
794
  makeLookAtView: makeLookAtView,
795
+ makeLookAt: makeLookAt,
769
796
  invert: invert,
770
797
  lookAt: lookAt,
771
798
  multiply: multiply$2,
@@ -1444,7 +1471,6 @@ function rotateAboutAxis(angle, point, axisDirection, axisPosition) {
1444
1471
  }
1445
1472
  /**
1446
1473
  * Returns a vector that is multiplied with a matrix.
1447
- * Is it v*m or m*v?
1448
1474
  */
1449
1475
  function transformMatrix$1(vector, m) {
1450
1476
  var x = vector.x, y = vector.y, z = vector.z;