@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.
@@ -554,6 +554,32 @@ function makeLookAtView(position, lookAt, up) {
554
554
  ];
555
555
  /* eslint-enable prettier/prettier */
556
556
  }
557
+ /**
558
+ * Matrix becomes a combination of translation and rotation.
559
+ *
560
+ * Matrix becomes a combination of a translation to the position of 'eye' and a
561
+ * rotation matrix which orients an object to point towards 'center' along its
562
+ * z-axis. Use this function if you want an object to look at a point from
563
+ * another point in space.
564
+ *
565
+ * @param position The position of the object.
566
+ * @param lookAt The point which the object is looking at.
567
+ * @param up The direction which the object considers up.
568
+ * @returns A matrix.
569
+ */
570
+ function makeLookAt(position, lookAt, up) {
571
+ var z = normalize(subtract(position, lookAt));
572
+ var x = normalize(cross(up, z));
573
+ var y = cross(z, x);
574
+ /* eslint-disable prettier/prettier */
575
+ return [
576
+ x.x, x.y, x.z, 0,
577
+ y.x, y.y, y.z, 0,
578
+ z.x, z.y, z.z, 0,
579
+ position.x, position.y, position.z, 1
580
+ ];
581
+ /* eslint-enable prettier/prettier */
582
+ }
557
583
  /**
558
584
  * Returns the inverse of the given matrix. If the determinate of the matrix is
559
585
  * zero, then a zero matrix is returned.
@@ -762,6 +788,7 @@ var matrix4 = /*#__PURE__*/Object.freeze({
762
788
  makePerspective: makePerspective,
763
789
  makeOrthographic: makeOrthographic,
764
790
  makeLookAtView: makeLookAtView,
791
+ makeLookAt: makeLookAt,
765
792
  invert: invert,
766
793
  lookAt: lookAt,
767
794
  multiply: multiply$2,
@@ -1440,7 +1467,6 @@ function rotateAboutAxis(angle, point, axisDirection, axisPosition) {
1440
1467
  }
1441
1468
  /**
1442
1469
  * Returns a vector that is multiplied with a matrix.
1443
- * Is it v*m or m*v?
1444
1470
  */
1445
1471
  function transformMatrix$1(vector, m) {
1446
1472
  var x = vector.x, y = vector.y, z = vector.z;