@math.gl/culling 4.1.0 → 4.2.0-alpha.3

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.
package/dist/index.cjs CHANGED
@@ -25,6 +25,7 @@ __export(dist_exports, {
25
25
  INTERSECTION: () => INTERSECTION,
26
26
  OrientedBoundingBox: () => OrientedBoundingBox,
27
27
  Plane: () => Plane,
28
+ Ray: () => Ray,
28
29
  _PerspectiveFrustum: () => PerspectiveFrustum,
29
30
  _PerspectiveOffCenterFrustum: () => PerspectiveOffCenterFrustum,
30
31
  computeEigenDecomposition: () => computeEigenDecomposition,
@@ -521,6 +522,30 @@ var Plane = class {
521
522
  const scaledNormal = scratchNormal2.copy(this.normal).scale(pointDistance);
522
523
  return scratchPoint.subtract(scaledNormal).to(result);
523
524
  }
525
+ /**
526
+ * Computes the intersection of a ray and this plane.
527
+ *
528
+ * @param {Ray} ray The ray.
529
+ * @param {Vector3} [result] The object onto which to store the result.
530
+ * @returns {Vector3} The intersection point or undefined if there is no intersections.
531
+ */
532
+ intersectWithRay(ray, result) {
533
+ if (!result)
534
+ result = new import_core4.Vector3();
535
+ const origin = ray.origin;
536
+ const direction = ray.direction;
537
+ const normal = this.normal;
538
+ const denominator = normal.dot(direction);
539
+ if (Math.abs(denominator) < import_core4._MathUtils.EPSILON15) {
540
+ return void 0;
541
+ }
542
+ const t = (-this.distance - normal.dot(origin)) / denominator;
543
+ if (t < 0) {
544
+ return void 0;
545
+ }
546
+ result = result.copy(direction).multiplyByScalar(t);
547
+ return origin.add(result);
548
+ }
524
549
  };
525
550
 
526
551
  // dist/lib/culling-volume.js
@@ -613,13 +638,36 @@ CullingVolume.MASK_OUTSIDE = 4294967295;
613
638
  CullingVolume.MASK_INSIDE = 0;
614
639
  CullingVolume.MASK_INDETERMINATE = 2147483647;
615
640
 
616
- // dist/lib/perspective-off-center-frustum.js
641
+ // dist/lib/ray.js
617
642
  var import_core6 = require("@math.gl/core");
618
- var scratchPlaneUpVector = new import_core6.Vector3();
619
- var scratchPlaneRightVector = new import_core6.Vector3();
620
- var scratchPlaneNearCenter = new import_core6.Vector3();
621
- var scratchPlaneFarCenter = new import_core6.Vector3();
622
- var scratchPlaneNormal2 = new import_core6.Vector3();
643
+ var Ray = class {
644
+ /**
645
+ * Creates a new ray that extends infinitely from the provided origin in the provided direction.
646
+ *
647
+ * @param [origin=Vector3] The origin of the ray.
648
+ * @param [direction=Vector3] The direction of the ray.
649
+ */
650
+ constructor(origin, direction) {
651
+ if (origin)
652
+ origin = origin.clone();
653
+ else
654
+ origin = new import_core6.Vector3();
655
+ if (direction)
656
+ direction = direction.clone().normalize();
657
+ else
658
+ direction = new import_core6.Vector3();
659
+ this.origin = origin;
660
+ this.direction = direction;
661
+ }
662
+ };
663
+
664
+ // dist/lib/perspective-off-center-frustum.js
665
+ var import_core7 = require("@math.gl/core");
666
+ var scratchPlaneUpVector = new import_core7.Vector3();
667
+ var scratchPlaneRightVector = new import_core7.Vector3();
668
+ var scratchPlaneNearCenter = new import_core7.Vector3();
669
+ var scratchPlaneFarCenter = new import_core7.Vector3();
670
+ var scratchPlaneNormal2 = new import_core7.Vector3();
623
671
  var PerspectiveOffCenterFrustum = class {
624
672
  /**
625
673
  * The viewing frustum is defined by 6 planes.
@@ -650,8 +698,8 @@ var PerspectiveOffCenterFrustum = class {
650
698
  new Plane(),
651
699
  new Plane()
652
700
  ]);
653
- this._perspectiveMatrix = new import_core6.Matrix4();
654
- this._infinitePerspective = new import_core6.Matrix4();
701
+ this._perspectiveMatrix = new import_core7.Matrix4();
702
+ this._infinitePerspective = new import_core7.Matrix4();
655
703
  const { near = 1, far = 5e8 } = options;
656
704
  this.left = options.left;
657
705
  this._left = void 0;
@@ -722,9 +770,9 @@ var PerspectiveOffCenterFrustum = class {
722
770
  */
723
771
  // eslint-disable-next-line complexity, max-statements
724
772
  computeCullingVolume(position, direction, up) {
725
- (0, import_core6.assert)(position, "position is required.");
726
- (0, import_core6.assert)(direction, "direction is required.");
727
- (0, import_core6.assert)(up, "up is required.");
773
+ (0, import_core7.assert)(position, "position is required.");
774
+ (0, import_core7.assert)(direction, "direction is required.");
775
+ (0, import_core7.assert)(up, "up is required.");
728
776
  const planes = this._cullingVolume.planes;
729
777
  up = scratchPlaneUpVector.copy(up).normalize();
730
778
  const right = scratchPlaneRightVector.copy(direction).cross(up).normalize();
@@ -739,7 +787,7 @@ var PerspectiveOffCenterFrustum = class {
739
787
  planes[2].fromPointNormal(position, normal);
740
788
  normal.copy(up).multiplyByScalar(this.top).add(nearCenter).subtract(position).cross(right);
741
789
  planes[3].fromPointNormal(position, normal);
742
- normal = new import_core6.Vector3().copy(direction);
790
+ normal = new import_core7.Vector3().copy(direction);
743
791
  planes[4].fromPointNormal(nearCenter, normal);
744
792
  normal.negate();
745
793
  planes[5].fromPointNormal(farCenter, normal);
@@ -771,11 +819,11 @@ var PerspectiveOffCenterFrustum = class {
771
819
  */
772
820
  getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result) {
773
821
  this._update();
774
- (0, import_core6.assert)(Number.isFinite(drawingBufferWidth) && Number.isFinite(drawingBufferHeight));
775
- (0, import_core6.assert)(drawingBufferWidth > 0);
776
- (0, import_core6.assert)(drawingBufferHeight > 0);
777
- (0, import_core6.assert)(distance > 0);
778
- (0, import_core6.assert)(result);
822
+ (0, import_core7.assert)(Number.isFinite(drawingBufferWidth) && Number.isFinite(drawingBufferHeight));
823
+ (0, import_core7.assert)(drawingBufferWidth > 0);
824
+ (0, import_core7.assert)(drawingBufferHeight > 0);
825
+ (0, import_core7.assert)(distance > 0);
826
+ (0, import_core7.assert)(result);
779
827
  const inverseNear = 1 / this.near;
780
828
  let tanTheta = this.top * inverseNear;
781
829
  const pixelHeight = 2 * distance * tanTheta / drawingBufferHeight;
@@ -787,17 +835,17 @@ var PerspectiveOffCenterFrustum = class {
787
835
  }
788
836
  // eslint-disable-next-line complexity, max-statements
789
837
  _update() {
790
- (0, import_core6.assert)(Number.isFinite(this.right) && Number.isFinite(this.left) && Number.isFinite(this.top) && Number.isFinite(this.bottom) && Number.isFinite(this.near) && Number.isFinite(this.far));
838
+ (0, import_core7.assert)(Number.isFinite(this.right) && Number.isFinite(this.left) && Number.isFinite(this.top) && Number.isFinite(this.bottom) && Number.isFinite(this.near) && Number.isFinite(this.far));
791
839
  const { top, bottom, right, left, near, far } = this;
792
840
  if (top !== this._top || bottom !== this._bottom || left !== this._left || right !== this._right || near !== this._near || far !== this._far) {
793
- (0, import_core6.assert)(this.near > 0 && this.near < this.far, "near must be greater than zero and less than far.");
841
+ (0, import_core7.assert)(this.near > 0 && this.near < this.far, "near must be greater than zero and less than far.");
794
842
  this._left = left;
795
843
  this._right = right;
796
844
  this._top = top;
797
845
  this._bottom = bottom;
798
846
  this._near = near;
799
847
  this._far = far;
800
- this._perspectiveMatrix = new import_core6.Matrix4().frustum({
848
+ this._perspectiveMatrix = new import_core7.Matrix4().frustum({
801
849
  left,
802
850
  right,
803
851
  bottom,
@@ -805,7 +853,7 @@ var PerspectiveOffCenterFrustum = class {
805
853
  near,
806
854
  far
807
855
  });
808
- this._infinitePerspective = new import_core6.Matrix4().frustum({
856
+ this._infinitePerspective = new import_core7.Matrix4().frustum({
809
857
  left,
810
858
  right,
811
859
  bottom,
@@ -818,7 +866,7 @@ var PerspectiveOffCenterFrustum = class {
818
866
  };
819
867
 
820
868
  // dist/lib/perspective-frustum.js
821
- var import_core7 = require("@math.gl/core");
869
+ var import_core8 = require("@math.gl/core");
822
870
  var defined = (val) => val !== null && typeof val !== "undefined";
823
871
  var PerspectiveFrustum = class {
824
872
  constructor(options = {}) {
@@ -920,16 +968,16 @@ var PerspectiveFrustum = class {
920
968
  */
921
969
  getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result) {
922
970
  this._update();
923
- return this._offCenterFrustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result || new import_core7.Vector2());
971
+ return this._offCenterFrustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, result || new import_core8.Vector2());
924
972
  }
925
973
  // eslint-disable-next-line complexity, max-statements
926
974
  _update() {
927
- (0, import_core7.assert)(Number.isFinite(this.fov) && Number.isFinite(this.aspectRatio) && Number.isFinite(this.near) && Number.isFinite(this.far));
975
+ (0, import_core8.assert)(Number.isFinite(this.fov) && Number.isFinite(this.aspectRatio) && Number.isFinite(this.near) && Number.isFinite(this.far));
928
976
  const f = this._offCenterFrustum;
929
977
  if (this.fov !== this._fov || this.aspectRatio !== this._aspectRatio || this.near !== this._near || this.far !== this._far || this.xOffset !== this._xOffset || this.yOffset !== this._yOffset) {
930
- (0, import_core7.assert)(this.fov >= 0 && this.fov < Math.PI);
931
- (0, import_core7.assert)(this.aspectRatio > 0);
932
- (0, import_core7.assert)(this.near >= 0 && this.near < this.far);
978
+ (0, import_core8.assert)(this.fov >= 0 && this.fov < Math.PI);
979
+ (0, import_core8.assert)(this.aspectRatio > 0);
980
+ (0, import_core8.assert)(this.near >= 0 && this.near < this.far);
933
981
  this._aspectRatio = this.aspectRatio;
934
982
  this._fov = this.fov;
935
983
  this._fovy = this.aspectRatio <= 1 ? this.fov : Math.atan(Math.tan(this.fov * 0.5) / this.aspectRatio) * 2;
@@ -953,19 +1001,19 @@ var PerspectiveFrustum = class {
953
1001
  };
954
1002
 
955
1003
  // dist/lib/algorithms/bounding-sphere-from-points.js
956
- var import_core8 = require("@math.gl/core");
957
- var fromPointsXMin = new import_core8.Vector3();
958
- var fromPointsYMin = new import_core8.Vector3();
959
- var fromPointsZMin = new import_core8.Vector3();
960
- var fromPointsXMax = new import_core8.Vector3();
961
- var fromPointsYMax = new import_core8.Vector3();
962
- var fromPointsZMax = new import_core8.Vector3();
963
- var fromPointsCurrentPos = new import_core8.Vector3();
964
- var fromPointsScratch = new import_core8.Vector3();
965
- var fromPointsRitterCenter = new import_core8.Vector3();
966
- var fromPointsMinBoxPt = new import_core8.Vector3();
967
- var fromPointsMaxBoxPt = new import_core8.Vector3();
968
- var fromPointsNaiveCenterScratch = new import_core8.Vector3();
1004
+ var import_core9 = require("@math.gl/core");
1005
+ var fromPointsXMin = new import_core9.Vector3();
1006
+ var fromPointsYMin = new import_core9.Vector3();
1007
+ var fromPointsZMin = new import_core9.Vector3();
1008
+ var fromPointsXMax = new import_core9.Vector3();
1009
+ var fromPointsYMax = new import_core9.Vector3();
1010
+ var fromPointsZMax = new import_core9.Vector3();
1011
+ var fromPointsCurrentPos = new import_core9.Vector3();
1012
+ var fromPointsScratch = new import_core9.Vector3();
1013
+ var fromPointsRitterCenter = new import_core9.Vector3();
1014
+ var fromPointsMinBoxPt = new import_core9.Vector3();
1015
+ var fromPointsMaxBoxPt = new import_core9.Vector3();
1016
+ var fromPointsNaiveCenterScratch = new import_core9.Vector3();
969
1017
  function makeBoundingSphereFromPoints(positions, result = new BoundingSphere()) {
970
1018
  if (!positions || positions.length === 0) {
971
1019
  return result.fromCenterRadius([0, 0, 0], 0);
@@ -1061,17 +1109,17 @@ function makeBoundingSphereFromPoints(positions, result = new BoundingSphere())
1061
1109
  }
1062
1110
 
1063
1111
  // dist/lib/algorithms/bounding-box-from-points.js
1064
- var import_core10 = require("@math.gl/core");
1112
+ var import_core11 = require("@math.gl/core");
1065
1113
 
1066
1114
  // dist/lib/algorithms/compute-eigen-decomposition.js
1067
- var import_core9 = require("@math.gl/core");
1068
- var scratchMatrix = new import_core9.Matrix3();
1069
- var scratchUnitary = new import_core9.Matrix3();
1070
- var scratchDiagonal = new import_core9.Matrix3();
1071
- var jMatrix = new import_core9.Matrix3();
1072
- var jMatrixTranspose = new import_core9.Matrix3();
1115
+ var import_core10 = require("@math.gl/core");
1116
+ var scratchMatrix = new import_core10.Matrix3();
1117
+ var scratchUnitary = new import_core10.Matrix3();
1118
+ var scratchDiagonal = new import_core10.Matrix3();
1119
+ var jMatrix = new import_core10.Matrix3();
1120
+ var jMatrixTranspose = new import_core10.Matrix3();
1073
1121
  function computeEigenDecomposition(matrix, result = {}) {
1074
- const EIGEN_TOLERANCE = import_core9._MathUtils.EPSILON20;
1122
+ const EIGEN_TOLERANCE = import_core10._MathUtils.EPSILON20;
1075
1123
  const EIGEN_MAX_SWEEPS = 10;
1076
1124
  let count = 0;
1077
1125
  let sweep = 0;
@@ -1114,7 +1162,7 @@ function offDiagonalFrobeniusNorm(matrix) {
1114
1162
  return Math.sqrt(norm);
1115
1163
  }
1116
1164
  function shurDecomposition(matrix, result) {
1117
- const tolerance = import_core9._MathUtils.EPSILON15;
1165
+ const tolerance = import_core10._MathUtils.EPSILON15;
1118
1166
  let maxDiagonal = 0;
1119
1167
  let rotAxis = 1;
1120
1168
  for (let i = 0; i < 3; ++i) {
@@ -1142,7 +1190,7 @@ function shurDecomposition(matrix, result) {
1142
1190
  c = 1 / Math.sqrt(1 + t * t);
1143
1191
  s = t * c;
1144
1192
  }
1145
- import_core9.Matrix3.IDENTITY.to(result);
1193
+ import_core10.Matrix3.IDENTITY.to(result);
1146
1194
  result[scratchMatrix.getElementIndex(p, p)] = result[scratchMatrix.getElementIndex(q, q)] = c;
1147
1195
  result[scratchMatrix.getElementIndex(q, p)] = s;
1148
1196
  result[scratchMatrix.getElementIndex(p, q)] = -s;
@@ -1150,24 +1198,24 @@ function shurDecomposition(matrix, result) {
1150
1198
  }
1151
1199
 
1152
1200
  // dist/lib/algorithms/bounding-box-from-points.js
1153
- var scratchVector23 = new import_core10.Vector3();
1154
- var scratchVector32 = new import_core10.Vector3();
1155
- var scratchVector4 = new import_core10.Vector3();
1156
- var scratchVector5 = new import_core10.Vector3();
1157
- var scratchVector6 = new import_core10.Vector3();
1158
- var scratchCovarianceResult = new import_core10.Matrix3();
1201
+ var scratchVector23 = new import_core11.Vector3();
1202
+ var scratchVector32 = new import_core11.Vector3();
1203
+ var scratchVector4 = new import_core11.Vector3();
1204
+ var scratchVector5 = new import_core11.Vector3();
1205
+ var scratchVector6 = new import_core11.Vector3();
1206
+ var scratchCovarianceResult = new import_core11.Matrix3();
1159
1207
  var scratchEigenResult = {
1160
- diagonal: new import_core10.Matrix3(),
1161
- unitary: new import_core10.Matrix3()
1208
+ diagonal: new import_core11.Matrix3(),
1209
+ unitary: new import_core11.Matrix3()
1162
1210
  };
1163
1211
  function makeOrientedBoundingBoxFromPoints(positions, result = new OrientedBoundingBox()) {
1164
1212
  if (!positions || positions.length === 0) {
1165
- result.halfAxes = new import_core10.Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);
1166
- result.center = new import_core10.Vector3();
1213
+ result.halfAxes = new import_core11.Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);
1214
+ result.center = new import_core11.Vector3();
1167
1215
  return result;
1168
1216
  }
1169
1217
  const length = positions.length;
1170
- const meanPoint = new import_core10.Vector3(0, 0, 0);
1218
+ const meanPoint = new import_core11.Vector3(0, 0, 0);
1171
1219
  for (const position of positions) {
1172
1220
  meanPoint.add(position);
1173
1221
  }
@@ -1229,7 +1277,7 @@ function makeOrientedBoundingBoxFromPoints(positions, result = new OrientedBound
1229
1277
  v3 = v3.multiplyByScalar(0.5 * (l3 + u3));
1230
1278
  result.center.copy(v1).add(v2).add(v3);
1231
1279
  const scale = scratchVector32.set(u1 - l1, u2 - l2, u3 - l3).multiplyByScalar(0.5);
1232
- const scaleMatrix = new import_core10.Matrix3([scale[0], 0, 0, 0, scale[1], 0, 0, 0, scale[2]]);
1280
+ const scaleMatrix = new import_core11.Matrix3([scale[0], 0, 0, 0, scale[1], 0, 0, 0, scale[2]]);
1233
1281
  result.halfAxes.multiplyRight(scaleMatrix);
1234
1282
  return result;
1235
1283
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts", "../src/constants.ts", "../src/lib/bounding-volumes/axis-aligned-bounding-box.ts", "../src/lib/bounding-volumes/bounding-sphere.ts", "../src/lib/bounding-volumes/oriented-bounding-box.ts", "../src/lib/culling-volume.ts", "../src/lib/plane.ts", "../src/lib/perspective-off-center-frustum.ts", "../src/lib/perspective-frustum.ts", "../src/lib/algorithms/bounding-sphere-from-points.ts", "../src/lib/algorithms/bounding-box-from-points.ts", "../src/lib/algorithms/compute-eigen-decomposition.ts"],
4
- "sourcesContent": ["// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {INTERSECTION} from './constants';\n\nexport {AxisAlignedBoundingBox} from './lib/bounding-volumes/axis-aligned-bounding-box';\nexport {BoundingSphere} from './lib/bounding-volumes/bounding-sphere';\nexport {OrientedBoundingBox} from './lib/bounding-volumes/oriented-bounding-box';\nexport {CullingVolume} from './lib/culling-volume';\nexport {Plane} from './lib/plane';\n\nexport {PerspectiveOffCenterFrustum as _PerspectiveOffCenterFrustum} from './lib/perspective-off-center-frustum';\nexport {PerspectiveFrustum as _PerspectiveFrustum} from './lib/perspective-frustum';\n\nexport {makeBoundingSphereFromPoints} from './lib/algorithms/bounding-sphere-from-points';\nexport {\n makeAxisAlignedBoundingBoxFromPoints,\n makeOrientedBoundingBoxFromPoints\n} from './lib/algorithms/bounding-box-from-points';\nexport {computeEigenDecomposition} from './lib/algorithms/compute-eigen-decomposition';\n", "// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport const INTERSECTION = {\n OUTSIDE: -1, // Represents that an object is not contained within the frustum.\n INTERSECTING: 0, // Represents that an object intersects one of the frustum's planes.\n INSIDE: 1 // Represents that an object is fully within the frustum.\n} as const;\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\nimport {BoundingVolume} from './bounding-volume';\nimport {Vector3} from '@math.gl/core';\nimport {Plane} from '../plane';\nimport {INTERSECTION} from '../../constants';\n\nconst scratchVector = new Vector3();\nconst scratchNormal = new Vector3();\n\n/**\n * An axis aligned bounding box - aligned with coordinate axes\n * @see BoundingVolume\n * @see BoundingRectangle\n * @see OrientedBoundingBox\n */\nexport class AxisAlignedBoundingBox implements BoundingVolume {\n /** The center point of the bounding box. */\n readonly center: Vector3;\n /** The positive half diagonal of the bounding box. */\n readonly halfDiagonal: Vector3;\n /** The minimum point defining the bounding box. [0, 0, 0] for empty box */\n readonly minimum: Vector3;\n /** The maximum point defining the bounding box. [0, 0, 0] for empty box */\n readonly maximum: Vector3;\n\n /**\n * Creates an instance of an AxisAlignedBoundingBox from the minimum and maximum points along the x, y, and z axes.\n * @param minimum=[0, 0, 0] The minimum point along the x, y, and z axes.\n * @param maximum=[0, 0, 0] The maximum point along the x, y, and z axes.\n * @param center The center of the box; automatically computed if not supplied.\n */\n constructor(\n minimum: readonly number[] = [0, 0, 0],\n maximum: readonly number[] = [0, 0, 0],\n center?: readonly number[]\n ) {\n // If center was not defined, compute it.\n center = center || scratchVector.copy(minimum).add(maximum).scale(0.5);\n this.center = new Vector3(center);\n this.halfDiagonal = new Vector3(maximum).subtract(this.center);\n\n /**\n * The minimum point defining the bounding box.\n * @type {Vector3}\n * @default {@link 0, 0, 0}\n */\n this.minimum = new Vector3(minimum);\n\n /**\n * The maximum point defining the bounding box.\n * @type {Vector3}\n * @default {@link 0, 0, 0}\n */\n this.maximum = new Vector3(maximum);\n }\n\n /**\n * Duplicates a AxisAlignedBoundingBox instance.\n *\n * @returns {AxisAlignedBoundingBox} A new AxisAlignedBoundingBox instance.\n */\n clone(): AxisAlignedBoundingBox {\n return new AxisAlignedBoundingBox(this.minimum, this.maximum, this.center);\n }\n\n /**\n * Compares the provided AxisAlignedBoundingBox componentwise and returns\n * <code>true</code> if they are equal, <code>false</code> otherwise.\n *\n * @param {AxisAlignedBoundingBox} [right] The second AxisAlignedBoundingBox to compare with.\n * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.\n */\n equals(right: AxisAlignedBoundingBox): boolean {\n return (\n this === right ||\n (Boolean(right) && this.minimum.equals(right.minimum) && this.maximum.equals(right.maximum))\n );\n }\n\n /**\n * Applies a 4x4 affine transformation matrix to a bounding sphere.\n * @param transform The transformation matrix to apply to the bounding sphere.\n * @returns itself, i.e. the modified BoundingVolume.\n */\n transform(transform: readonly number[]): this {\n this.center.transformAsPoint(transform);\n // TODO - this.halfDiagonal.transformAsVector(transform);\n this.halfDiagonal.transform(transform);\n this.minimum.transform(transform);\n this.maximum.transform(transform);\n return this;\n }\n\n /**\n * Determines which side of a plane a box is located.\n */\n intersectPlane(plane: Plane): number {\n const {halfDiagonal} = this;\n const normal = scratchNormal.from(plane.normal);\n const e =\n halfDiagonal.x * Math.abs(normal.x) +\n halfDiagonal.y * Math.abs(normal.y) +\n halfDiagonal.z * Math.abs(normal.z);\n const s = this.center.dot(normal) + plane.distance; // signed distance from center\n\n if (s - e > 0) {\n return INTERSECTION.INSIDE;\n }\n\n if (s + e < 0) {\n // Not in front because normals point inward\n return INTERSECTION.OUTSIDE;\n }\n\n return INTERSECTION.INTERSECTING;\n }\n\n /** Computes the estimated distance from the closest point on a bounding box to a point. */\n distanceTo(point: readonly number[]): number {\n return Math.sqrt(this.distanceSquaredTo(point));\n }\n\n /** Computes the estimated distance squared from the closest point on a bounding box to a point. */\n distanceSquaredTo(point: readonly number[]): number {\n const offset = scratchVector.from(point).subtract(this.center);\n const {halfDiagonal} = this;\n\n let distanceSquared = 0.0;\n let d;\n\n d = Math.abs(offset.x) - halfDiagonal.x;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n d = Math.abs(offset.y) - halfDiagonal.y;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n d = Math.abs(offset.z) - halfDiagonal.z;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n return distanceSquared;\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {NumericArray, Vector3, mat4} from '@math.gl/core';\n\nimport {INTERSECTION} from '../../constants';\nimport {BoundingVolume} from './bounding-volume';\nimport {Plane} from '../plane';\n\nconst scratchVector = new Vector3();\nconst scratchVector2 = new Vector3();\n\n/** A BoundingSphere */\nexport class BoundingSphere implements BoundingVolume {\n center: Vector3;\n radius: number;\n\n /** Creates a bounding sphere */\n constructor(center: readonly number[] = [0, 0, 0], radius: number = 0.0) {\n this.radius = -0;\n this.center = new Vector3();\n this.fromCenterRadius(center, radius);\n }\n\n /** Sets the bounding sphere from `center` and `radius`. */\n fromCenterRadius(center: readonly number[], radius: number): this {\n this.center.from(center);\n this.radius = radius;\n return this;\n }\n\n /**\n * Computes a bounding sphere from the corner points of an axis-aligned bounding box. The sphere\n * tightly and fully encompasses the box.\n */\n fromCornerPoints(corner: readonly number[], oppositeCorner: readonly number[]): this {\n oppositeCorner = scratchVector.from(oppositeCorner);\n this.center = new Vector3().from(corner).add(oppositeCorner).scale(0.5);\n this.radius = this.center.distance(oppositeCorner);\n return this;\n }\n\n /** Compares the provided BoundingSphere component wise */\n equals(right: BoundingSphere): boolean {\n return (\n this === right ||\n (Boolean(right) && this.center.equals(right.center) && this.radius === right.radius)\n );\n }\n\n /** Duplicates a BoundingSphere instance. */\n clone(): BoundingSphere {\n return new BoundingSphere(this.center, this.radius);\n }\n\n /** Computes a bounding sphere that contains both the left and right bounding spheres. */\n union(boundingSphere: BoundingSphere): BoundingSphere {\n const leftCenter = this.center;\n const leftRadius = this.radius;\n const rightCenter = boundingSphere.center;\n const rightRadius = boundingSphere.radius;\n\n const toRightCenter = scratchVector.copy(rightCenter).subtract(leftCenter);\n const centerSeparation = toRightCenter.magnitude();\n\n if (leftRadius >= centerSeparation + rightRadius) {\n // Left sphere wins.\n return this.clone();\n }\n\n if (rightRadius >= centerSeparation + leftRadius) {\n // Right sphere wins.\n return boundingSphere.clone();\n }\n\n // There are two tangent points, one on far side of each sphere.\n const halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;\n\n // Compute the center point halfway between the two tangent points.\n scratchVector2\n .copy(toRightCenter)\n .scale((-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation)\n .add(leftCenter);\n\n this.center.copy(scratchVector2);\n this.radius = halfDistanceBetweenTangentPoints;\n\n return this;\n }\n\n /** Computes a bounding sphere by enlarging the provided sphere to contain the provided point. */\n expand(point: readonly number[]): this {\n const scratchPoint = scratchVector.from(point);\n const radius = scratchPoint.subtract(this.center).magnitude();\n if (radius > this.radius) {\n this.radius = radius;\n }\n return this;\n }\n\n // BoundingVolume interface\n\n /**\n * Applies a 4x4 affine transformation matrix to a bounding sphere.\n * @param sphere The bounding sphere to apply the transformation to.\n * @param transform The transformation matrix to apply to the bounding sphere.\n * @returns self.\n */\n transform(transform: readonly number[]): this {\n this.center.transform(transform);\n const scale = mat4.getScaling(scratchVector, transform);\n this.radius = Math.max(scale[0], Math.max(scale[1], scale[2])) * this.radius;\n return this;\n }\n\n /** Computes the estimated distance squared from the closest point on a bounding sphere to a point. */\n distanceSquaredTo(point: Readonly<NumericArray>): number {\n const d = this.distanceTo(point);\n return d * d;\n }\n\n /** Computes the estimated distance from the closest point on a bounding sphere to a point. */\n distanceTo(point: Readonly<NumericArray>): number {\n const scratchPoint = scratchVector.from(point);\n const delta = scratchPoint.subtract(this.center);\n return Math.max(0, delta.len() - this.radius);\n }\n\n /** Determines which side of a plane a sphere is located. */\n intersectPlane(plane: Plane): number {\n const center = this.center;\n const radius = this.radius;\n const normal = plane.normal;\n const distanceToPlane = normal.dot(center) + plane.distance;\n\n // The center point is negative side of the plane normal\n if (distanceToPlane < -radius) {\n return INTERSECTION.OUTSIDE;\n }\n // The center point is positive side of the plane, but radius extends beyond it; partial overlap\n if (distanceToPlane < radius) {\n return INTERSECTION.INTERSECTING;\n }\n // The center point and radius is positive side of the plane\n return INTERSECTION.INSIDE;\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {NumericArray} from '@math.gl/types';\nimport {Vector3, Matrix3, Matrix4, Quaternion} from '@math.gl/core';\nimport type {BoundingVolume} from './bounding-volume';\nimport {BoundingSphere} from './bounding-sphere';\nimport type {Plane} from '../plane';\nimport {INTERSECTION} from '../../constants';\n\nconst scratchVector3 = new Vector3();\nconst scratchOffset = new Vector3();\nconst scratchVectorU = new Vector3();\nconst scratchVectorV = new Vector3();\nconst scratchVectorW = new Vector3();\nconst scratchCorner = new Vector3();\nconst scratchToCenter = new Vector3();\n\nconst MATRIX3 = {\n COLUMN0ROW0: 0,\n COLUMN0ROW1: 1,\n COLUMN0ROW2: 2,\n COLUMN1ROW0: 3,\n COLUMN1ROW1: 4,\n COLUMN1ROW2: 5,\n COLUMN2ROW0: 6,\n COLUMN2ROW1: 7,\n COLUMN2ROW2: 8\n};\n\n/**\n * An OrientedBoundingBox of some object is a closed and convex cuboid.\n * It can provide a tighter bounding volume than `BoundingSphere` or\n * `AxisAlignedBoundingBox` in many cases.\n */\nexport class OrientedBoundingBox implements BoundingVolume {\n center: Vector3;\n halfAxes: Matrix3;\n\n /**\n * An OrientedBoundingBox of some object is a closed and convex cuboid.\n * It can provide a tighter bounding volume than\n * `BoundingSphere` or `AxisAlignedBoundingBox` in many cases.\n */\n constructor(center?: Readonly<NumericArray>, halfAxes?: Readonly<NumericArray>);\n constructor(\n center: Readonly<NumericArray> = [0, 0, 0],\n halfAxes: Readonly<NumericArray> = [0, 0, 0, 0, 0, 0, 0, 0, 0]\n ) {\n this.center = new Vector3().from(center);\n this.halfAxes = new Matrix3(halfAxes);\n }\n\n /** Returns an array with three halfSizes for the bounding box */\n get halfSize(): number[] {\n const xAxis = this.halfAxes.getColumn(0);\n const yAxis = this.halfAxes.getColumn(1);\n const zAxis = this.halfAxes.getColumn(2);\n return [new Vector3(xAxis).len(), new Vector3(yAxis).len(), new Vector3(zAxis).len()];\n }\n\n /** Returns a quaternion describing the orientation of the bounding box */\n get quaternion(): Quaternion {\n const xAxis = this.halfAxes.getColumn(0);\n const yAxis = this.halfAxes.getColumn(1);\n const zAxis = this.halfAxes.getColumn(2);\n const normXAxis = new Vector3(xAxis).normalize();\n const normYAxis = new Vector3(yAxis).normalize();\n const normZAxis = new Vector3(zAxis).normalize();\n return new Quaternion().fromMatrix3(new Matrix3([...normXAxis, ...normYAxis, ...normZAxis]));\n }\n\n /**\n * Create OrientedBoundingBox from quaternion based OBB,\n */\n fromCenterHalfSizeQuaternion(\n center: number[],\n halfSize: number[],\n quaternion: number[]\n ): OrientedBoundingBox {\n const quaternionObject = new Quaternion(quaternion);\n const directionsMatrix = new Matrix3().fromQuaternion(quaternionObject);\n directionsMatrix[0] = directionsMatrix[0] * halfSize[0];\n directionsMatrix[1] = directionsMatrix[1] * halfSize[0];\n directionsMatrix[2] = directionsMatrix[2] * halfSize[0];\n directionsMatrix[3] = directionsMatrix[3] * halfSize[1];\n directionsMatrix[4] = directionsMatrix[4] * halfSize[1];\n directionsMatrix[5] = directionsMatrix[5] * halfSize[1];\n directionsMatrix[6] = directionsMatrix[6] * halfSize[2];\n directionsMatrix[7] = directionsMatrix[7] * halfSize[2];\n directionsMatrix[8] = directionsMatrix[8] * halfSize[2];\n this.center = new Vector3().from(center);\n this.halfAxes = directionsMatrix;\n return this;\n }\n\n /** Duplicates a OrientedBoundingBox instance. */\n clone(): OrientedBoundingBox {\n return new OrientedBoundingBox(this.center, this.halfAxes);\n }\n\n /** Compares the provided OrientedBoundingBox component wise and returns */\n equals(right: OrientedBoundingBox): boolean {\n return (\n this === right ||\n (Boolean(right) && this.center.equals(right.center) && this.halfAxes.equals(right.halfAxes))\n );\n }\n\n /** Computes a tight-fitting bounding sphere enclosing the provided oriented bounding box. */\n getBoundingSphere(result = new BoundingSphere()): BoundingSphere {\n const halfAxes = this.halfAxes;\n const u = halfAxes.getColumn(0, scratchVectorU);\n const v = halfAxes.getColumn(1, scratchVectorV);\n const w = halfAxes.getColumn(2, scratchVectorW);\n\n // Calculate \"corner\" vector\n const cornerVector = scratchVector3.copy(u).add(v).add(w);\n\n result.center.copy(this.center);\n result.radius = cornerVector.magnitude();\n\n return result;\n }\n\n /** Determines which side of a plane the oriented bounding box is located. */\n intersectPlane(plane: Plane): number {\n const center = this.center;\n const normal = plane.normal;\n const halfAxes = this.halfAxes;\n\n const normalX = normal.x;\n const normalY = normal.y;\n const normalZ = normal.z;\n\n // Plane is used as if it is its normal; the first three components are assumed to be normalized\n const radEffective =\n Math.abs(\n normalX * halfAxes[MATRIX3.COLUMN0ROW0] +\n normalY * halfAxes[MATRIX3.COLUMN0ROW1] +\n normalZ * halfAxes[MATRIX3.COLUMN0ROW2]\n ) +\n Math.abs(\n normalX * halfAxes[MATRIX3.COLUMN1ROW0] +\n normalY * halfAxes[MATRIX3.COLUMN1ROW1] +\n normalZ * halfAxes[MATRIX3.COLUMN1ROW2]\n ) +\n Math.abs(\n normalX * halfAxes[MATRIX3.COLUMN2ROW0] +\n normalY * halfAxes[MATRIX3.COLUMN2ROW1] +\n normalZ * halfAxes[MATRIX3.COLUMN2ROW2]\n );\n const distanceToPlane = normal.dot(center) + plane.distance;\n\n if (distanceToPlane <= -radEffective) {\n // The entire box is on the negative side of the plane normal\n return INTERSECTION.OUTSIDE;\n } else if (distanceToPlane >= radEffective) {\n // The entire box is on the positive side of the plane normal\n return INTERSECTION.INSIDE;\n }\n return INTERSECTION.INTERSECTING;\n }\n\n /** Computes the estimated distance from the closest point on a bounding box to a point. */\n distanceTo(point: readonly number[]): number {\n return Math.sqrt(this.distanceSquaredTo(point));\n }\n\n /**\n * Computes the estimated distance squared from the closest point\n * on a bounding box to a point.\n * See Geometric Tools for Computer Graphics 10.4.2\n */\n distanceSquaredTo(point: readonly number[]): number {\n // Computes the estimated distance squared from the\n // closest point on a bounding box to a point.\n // See Geometric Tools for Computer Graphics 10.4.2\n const offset = scratchOffset.from(point).subtract(this.center);\n\n const halfAxes = this.halfAxes;\n const u = halfAxes.getColumn(0, scratchVectorU);\n const v = halfAxes.getColumn(1, scratchVectorV);\n const w = halfAxes.getColumn(2, scratchVectorW);\n\n const uHalf = u.magnitude();\n const vHalf = v.magnitude();\n const wHalf = w.magnitude();\n\n u.normalize();\n v.normalize();\n w.normalize();\n\n let distanceSquared = 0.0;\n let d;\n\n d = Math.abs(offset.dot(u)) - uHalf;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n d = Math.abs(offset.dot(v)) - vHalf;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n d = Math.abs(offset.dot(w)) - wHalf;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n return distanceSquared;\n }\n\n /**\n * The distances calculated by the vector from the center of the bounding box\n * to position projected onto direction.\n *\n * - If you imagine the infinite number of planes with normal direction,\n * this computes the smallest distance to the closest and farthest planes\n * from `position` that intersect the bounding box.\n *\n * @param position The position to calculate the distance from.\n * @param direction The direction from position.\n * @param result An Interval (array of length 2) to store the nearest and farthest distances.\n * @returns Interval (array of length 2) with nearest and farthest distances\n * on the bounding box from position in direction.\n */\n // eslint-disable-next-line max-statements\n computePlaneDistances(\n position: readonly number[],\n direction: Vector3,\n result: number[] = [-0, -0]\n ): number[] {\n let minDist = Number.POSITIVE_INFINITY;\n let maxDist = Number.NEGATIVE_INFINITY;\n\n const center = this.center;\n const halfAxes = this.halfAxes;\n\n const u = halfAxes.getColumn(0, scratchVectorU);\n const v = halfAxes.getColumn(1, scratchVectorV);\n const w = halfAxes.getColumn(2, scratchVectorW);\n\n // project first corner\n const corner = scratchCorner.copy(u).add(v).add(w).add(center);\n\n const toCenter = scratchToCenter.copy(corner).subtract(position);\n let mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project second corner\n corner.copy(center).add(u).add(v).subtract(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project third corner\n corner.copy(center).add(u).subtract(v).add(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project fourth corner\n corner.copy(center).add(u).subtract(v).subtract(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project fifth corner\n center.copy(corner).subtract(u).add(v).add(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project sixth corner\n center.copy(corner).subtract(u).add(v).subtract(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project seventh corner\n center.copy(corner).subtract(u).subtract(v).add(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project eighth corner\n center.copy(corner).subtract(u).subtract(v).subtract(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n result[0] = minDist;\n result[1] = maxDist;\n return result;\n }\n\n /**\n * Applies a 4x4 affine transformation matrix to a bounding sphere.\n * @param transform The transformation matrix to apply to the bounding sphere.\n * @returns itself, i.e. the modified BoundingVolume.\n */\n transform(transformation: readonly number[]): this {\n this.center.transformAsPoint(transformation);\n\n const xAxis = this.halfAxes.getColumn(0, scratchVectorU);\n xAxis.transformAsPoint(transformation);\n\n const yAxis = this.halfAxes.getColumn(1, scratchVectorV);\n yAxis.transformAsPoint(transformation);\n\n const zAxis = this.halfAxes.getColumn(2, scratchVectorW);\n zAxis.transformAsPoint(transformation);\n\n this.halfAxes = new Matrix3([...xAxis, ...yAxis, ...zAxis]);\n return this;\n }\n\n getTransform(): Matrix4 {\n // const modelMatrix = Matrix4.fromRotationTranslation(this.boundingVolume.halfAxes, this.boundingVolume.center);\n // return modelMatrix;\n throw new Error('not implemented');\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Vector3, assert} from '@math.gl/core';\nimport {INTERSECTION} from '../constants';\nimport {Plane} from './plane';\nimport type {BoundingVolume} from './bounding-volumes/bounding-volume';\nimport type {BoundingSphere} from './bounding-volumes/bounding-sphere';\n\n// X, Y, Z Unit vectors\nconst faces = [new Vector3([1, 0, 0]), new Vector3([0, 1, 0]), new Vector3([0, 0, 1])];\n\nconst scratchPlaneCenter = new Vector3();\nconst scratchPlaneNormal = new Vector3();\n// const scratchPlane = new Plane(new Vector3(1.0, 0.0, 0.0), 0.0);\n\n/** A culling volume defined by planes. */\nexport class CullingVolume {\n /**\n * For plane masks (as used in {@link CullingVolume#computeVisibilityWithPlaneMask}), this special value\n * represents the case where the object bounding volume is entirely outside the culling volume.\n */\n static MASK_OUTSIDE = 0xffffffff;\n\n /**\n * For plane masks (as used in {@link CullingVolume.prototype.computeVisibilityWithPlaneMask}), this value\n * represents the case where the object bounding volume is entirely inside the culling volume.\n */\n static MASK_INSIDE = 0x00000000;\n\n /**\n * For plane masks (as used in {@link CullingVolume.prototype.computeVisibilityWithPlaneMask}), this value\n * represents the case where the object bounding volume (may) intersect all planes of the culling volume.\n */\n static MASK_INDETERMINATE = 0x7fffffff;\n\n /** Array of clipping planes. */\n readonly planes: Plane[];\n\n /**\n * Create a new `CullingVolume` bounded by an array of clipping planed\n * @param planes Array of clipping planes.\n * */\n constructor(planes: Plane[] = []) {\n this.planes = planes;\n }\n\n /**\n * Constructs a culling volume from a bounding sphere. Creates six planes that create a box containing the sphere.\n * The planes are aligned to the x, y, and z axes in world coordinates.\n */\n fromBoundingSphere(boundingSphere: BoundingSphere): CullingVolume {\n this.planes.length = 2 * faces.length;\n\n const center = boundingSphere.center;\n const radius = boundingSphere.radius;\n\n let planeIndex = 0;\n\n for (const faceNormal of faces) {\n let plane0 = this.planes[planeIndex];\n let plane1 = this.planes[planeIndex + 1];\n\n if (!plane0) {\n plane0 = this.planes[planeIndex] = new Plane();\n }\n if (!plane1) {\n plane1 = this.planes[planeIndex + 1] = new Plane();\n }\n\n const plane0Center = scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);\n // const plane0Distance = -faceNormal.dot(plane0Center);\n\n plane0.fromPointNormal(plane0Center, faceNormal);\n\n const plane1Center = scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);\n\n const negatedFaceNormal = scratchPlaneNormal.copy(faceNormal).negate();\n\n // const plane1Distance = -negatedFaceNormal.dot(plane1Center);\n\n plane1.fromPointNormal(plane1Center, negatedFaceNormal);\n\n planeIndex += 2;\n }\n\n return this;\n }\n\n /** Determines whether a bounding volume intersects the culling volume. */\n computeVisibility(boundingVolume: BoundingVolume): number {\n // const planes = this.planes;\n let intersect: number = INTERSECTION.INSIDE;\n for (const plane of this.planes) {\n const result = boundingVolume.intersectPlane(plane);\n switch (result) {\n case INTERSECTION.OUTSIDE:\n // We are done\n return INTERSECTION.OUTSIDE;\n\n case INTERSECTION.INTERSECTING:\n // If no other intersection is outside, return INTERSECTING\n intersect = INTERSECTION.INTERSECTING;\n break;\n\n default:\n }\n }\n\n return intersect;\n }\n\n /**\n * Determines whether a bounding volume intersects the culling volume.\n *\n * @param parentPlaneMask A bit mask from the boundingVolume's parent's check against the same culling\n * volume, such that if (planeMask & (1 << planeIndex) === 0), for k < 31, then\n * the parent (and therefore this) volume is completely inside plane[planeIndex]\n * and that plane check can be skipped.\n */\n computeVisibilityWithPlaneMask(boundingVolume: BoundingVolume, parentPlaneMask: number): number {\n assert(Number.isFinite(parentPlaneMask), 'parentPlaneMask is required.');\n\n if (\n parentPlaneMask === CullingVolume.MASK_OUTSIDE ||\n parentPlaneMask === CullingVolume.MASK_INSIDE\n ) {\n // parent is completely outside or completely inside, so this child is as well.\n return parentPlaneMask;\n }\n\n // Start with MASK_INSIDE (all zeros) so that after the loop, the return value can be compared with MASK_INSIDE.\n // (Because if there are fewer than 31 planes, the upper bits wont be changed.)\n let mask = CullingVolume.MASK_INSIDE;\n\n const planes = this.planes;\n for (let k = 0; k < this.planes.length; ++k) {\n // For k greater than 31 (since 31 is the maximum number of INSIDE/INTERSECTING bits we can store), skip the optimization.\n const flag = k < 31 ? 1 << k : 0;\n if (k < 31 && (parentPlaneMask & flag) === 0) {\n // boundingVolume is known to be INSIDE this plane.\n continue;\n }\n\n const plane = planes[k];\n const result = boundingVolume.intersectPlane(plane);\n if (result === INTERSECTION.OUTSIDE) {\n return CullingVolume.MASK_OUTSIDE;\n } else if (result === INTERSECTION.INTERSECTING) {\n mask |= flag;\n }\n }\n\n return mask;\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Vector3, equals, assert, NumericArray} from '@math.gl/core';\n\nconst scratchPosition = new Vector3();\nconst scratchNormal = new Vector3();\n\n// A plane in Hessian Normal Form\nexport class Plane {\n readonly normal: Vector3;\n distance: number;\n\n constructor(normal: Readonly<NumericArray> = [0, 0, 1], distance: number = 0) {\n this.normal = new Vector3();\n this.distance = -0;\n this.fromNormalDistance(normal, distance);\n }\n\n /** Creates a plane from a normal and a distance from the origin. */\n fromNormalDistance(normal: Readonly<NumericArray>, distance: number): this {\n assert(Number.isFinite(distance));\n this.normal.from(normal).normalize();\n this.distance = distance;\n return this;\n }\n\n /** Creates a plane from a normal and a point on the plane. */\n fromPointNormal(point: Readonly<NumericArray>, normal: Readonly<NumericArray>): this {\n point = scratchPosition.from(point);\n this.normal.from(normal).normalize();\n const distance = -this.normal.dot(point);\n this.distance = distance;\n return this;\n }\n\n /** Creates a plane from the general equation */\n fromCoefficients(a: number, b: number, c: number, d: number): this {\n this.normal.set(a, b, c);\n assert(equals(this.normal.len(), 1));\n this.distance = d;\n return this;\n }\n\n /** Duplicates a Plane instance. */\n clone(): Plane {\n return new Plane(this.normal, this.distance);\n }\n\n /** Compares the provided Planes by normal and distance */\n equals(right: Plane): boolean {\n return equals(this.distance, right.distance) && equals(this.normal, right.normal);\n }\n\n /** Computes the signed shortest distance of a point to a plane.\n * The sign of the distance determines which side of the plane the point is on.\n */\n getPointDistance(point: Readonly<NumericArray>): number {\n return this.normal.dot(point) + this.distance;\n }\n\n /** Transforms the plane by the given transformation matrix. */\n transform(matrix4: Readonly<NumericArray>): this {\n const normal = scratchNormal.copy(this.normal).transformAsVector(matrix4).normalize();\n const point = this.normal.scale(-this.distance).transform(matrix4);\n return this.fromPointNormal(point, normal);\n }\n\n /** Projects a point onto the plane. */\n projectPointOntoPlane(point: Readonly<NumericArray>, result: Vector3): Vector3;\n projectPointOntoPlane(\n point: Readonly<NumericArray>,\n result?: readonly number[]\n ): readonly number[];\n\n projectPointOntoPlane(point: Readonly<NumericArray>, result = [0, 0, 0]) {\n const scratchPoint = scratchPosition.from(point);\n // projectedPoint = point - (normal.point + scale) * normal\n const pointDistance = this.getPointDistance(scratchPoint);\n const scaledNormal = scratchNormal.copy(this.normal).scale(pointDistance);\n\n return scratchPoint.subtract(scaledNormal).to(result);\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// Note: This class is still an experimental export, mainly used by other test cases\n// - It has not been fully adapted to math.gl conventions\n// - Documentation has not been ported\n\nimport {Vector3, Vector2, Matrix4, assert, NumericArray} from '@math.gl/core';\nimport {CullingVolume} from './culling-volume';\nimport {Plane} from './plane';\n\nconst scratchPlaneUpVector = new Vector3();\nconst scratchPlaneRightVector = new Vector3();\nconst scratchPlaneNearCenter = new Vector3();\nconst scratchPlaneFarCenter = new Vector3();\nconst scratchPlaneNormal = new Vector3();\n\ntype PerspectiveOffCenterFrustumOptions = {\n left?: number;\n right?: number;\n top?: number;\n bottom?: number;\n near?: number;\n far?: number;\n};\n\nexport class PerspectiveOffCenterFrustum {\n /**\n * Defines the left clipping plane.\n * @type {Number}\n * @default undefined\n */\n left?: number;\n private _left?: number;\n /**\n * Defines the right clipping plane.\n * @type {Number}\n * @default undefined\n */\n right?: number;\n private _right?: number;\n /**\n * Defines the top clipping plane.\n * @type {Number}\n * @default undefined\n */\n top?: number;\n private _top?: number;\n /**\n * Defines the bottom clipping plane.\n * @type {Number}\n * @default undefined\n */\n bottom?: number;\n private _bottom?: number;\n /**\n * The distance of the near plane.\n * @type {Number}\n * @default 1.0\n */\n near: number;\n private _near: number;\n /**\n * The distance of the far plane.\n * @type {Number}\n * @default 500000000.0\n */\n far: number;\n private _far: number;\n\n private _cullingVolume = new CullingVolume([\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane()\n ]);\n private _perspectiveMatrix = new Matrix4();\n private _infinitePerspective = new Matrix4();\n\n /**\n * The viewing frustum is defined by 6 planes.\n * Each plane is represented by a {@link Vector4} object, where the x, y, and z components\n * define the unit vector normal to the plane, and the w component is the distance of the\n * plane from the origin/camera position.\n *\n * @alias PerspectiveOffCenterFrustum\n *\n * @example\n * const frustum = new PerspectiveOffCenterFrustum({\n * left : -1.0,\n * right : 1.0,\n * top : 1.0,\n * bottom : -1.0,\n * near : 1.0,\n * far : 100.0\n * });\n *\n * @see PerspectiveFrustum\n */\n constructor(options: PerspectiveOffCenterFrustumOptions = {}) {\n const {near = 1.0, far = 500000000.0} = options;\n\n this.left = options.left;\n this._left = undefined;\n\n this.right = options.right;\n this._right = undefined;\n\n this.top = options.top;\n this._top = undefined;\n\n this.bottom = options.bottom;\n this._bottom = undefined;\n\n this.near = near;\n this._near = near;\n\n this.far = far;\n this._far = far;\n }\n\n /**\n * Returns a duplicate of a PerspectiveOffCenterFrustum instance.\n * @returns {PerspectiveOffCenterFrustum} A new PerspectiveFrustum instance.\n * */\n clone(): PerspectiveOffCenterFrustum {\n return new PerspectiveOffCenterFrustum({\n right: this.right,\n left: this.left,\n top: this.top,\n bottom: this.bottom,\n near: this.near,\n far: this.far\n });\n }\n\n /**\n * Compares the provided PerspectiveOffCenterFrustum componentwise and returns\n * <code>true</code> if they are equal, <code>false</code> otherwise.\n *\n * @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.\n */\n equals(other: PerspectiveOffCenterFrustum): boolean {\n return (\n other &&\n other instanceof PerspectiveOffCenterFrustum &&\n this.right === other.right &&\n this.left === other.left &&\n this.top === other.top &&\n this.bottom === other.bottom &&\n this.near === other.near &&\n this.far === other.far\n );\n }\n\n /**\n * Gets the perspective projection matrix computed from the view frustum.\n * @memberof PerspectiveOffCenterFrustum.prototype\n * @type {Matrix4}\n *\n * @see PerspectiveOffCenterFrustum#infiniteProjectionMatrix\n */\n get projectionMatrix(): Matrix4 {\n this._update();\n return this._perspectiveMatrix;\n }\n\n /**\n * Gets the perspective projection matrix computed from the view frustum with an infinite far plane.\n * @memberof PerspectiveOffCenterFrustum.prototype\n * @type {Matrix4}\n *\n * @see PerspectiveOffCenterFrustum#projectionMatrix\n */\n get infiniteProjectionMatrix(): Matrix4 {\n this._update();\n return this._infinitePerspective;\n }\n\n /**\n * Creates a culling volume for this frustum.\n * @returns {CullingVolume} A culling volume at the given position and orientation.\n *\n * @example\n * // Check if a bounding volume intersects the frustum.\n * const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);\n * const intersect = cullingVolume.computeVisibility(boundingVolume);\n */\n // eslint-disable-next-line complexity, max-statements\n computeCullingVolume(\n /** A Vector3 defines the eye position. */\n position: Readonly<NumericArray>,\n /** A Vector3 defines the view direction. */\n direction: Readonly<NumericArray>,\n /** A Vector3 defines the up direction. */\n up: Readonly<NumericArray>\n ): CullingVolume {\n assert(position, 'position is required.');\n assert(direction, 'direction is required.');\n assert(up, 'up is required.');\n\n const planes = this._cullingVolume.planes;\n\n up = scratchPlaneUpVector.copy(up).normalize();\n const right = scratchPlaneRightVector.copy(direction).cross(up).normalize();\n\n const nearCenter = scratchPlaneNearCenter\n .copy(direction)\n .multiplyByScalar(this.near)\n .add(position);\n\n const farCenter = scratchPlaneFarCenter\n .copy(direction)\n .multiplyByScalar(this.far)\n .add(position);\n\n let normal = scratchPlaneNormal;\n\n // Left plane computation\n normal.copy(right).multiplyByScalar(this.left).add(nearCenter).subtract(position).cross(up);\n\n planes[0].fromPointNormal(position, normal);\n\n // Right plane computation\n normal\n .copy(right)\n .multiplyByScalar(this.right)\n .add(nearCenter)\n .subtract(position)\n .cross(up)\n .negate();\n\n planes[1].fromPointNormal(position, normal);\n\n // Bottom plane computation\n normal\n .copy(up)\n .multiplyByScalar(this.bottom)\n .add(nearCenter)\n .subtract(position)\n .cross(right)\n .negate();\n\n planes[2].fromPointNormal(position, normal);\n\n // Top plane computation\n normal.copy(up).multiplyByScalar(this.top).add(nearCenter).subtract(position).cross(right);\n\n planes[3].fromPointNormal(position, normal);\n\n normal = new Vector3().copy(direction);\n\n // Near plane computation\n planes[4].fromPointNormal(nearCenter, normal);\n\n // Far plane computation\n normal.negate();\n\n planes[5].fromPointNormal(farCenter, normal);\n\n return this._cullingVolume;\n }\n\n /**\n * Returns the pixel's width and height in meters.\n *\n * @returns {Vector2} The modified result parameter or a new instance of {@link Vector2} with the pixel's width and height in the x and y properties, respectively.\n *\n * @exception {DeveloperError} drawingBufferWidth must be greater than zero.\n * @exception {DeveloperError} drawingBufferHeight must be greater than zero.\n *\n * @example\n * // Example 1\n * // Get the width and height of a pixel.\n * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, new Vector2());\n *\n * @example\n * // Example 2\n * // Get the width and height of a pixel if the near plane was set to 'distance'.\n * // For example, get the size of a pixel of an image on a billboard.\n * const position = camera.position;\n * const direction = camera.direction;\n * const toCenter = Vector3.subtract(primitive.boundingVolume.center, position, new Vector3()); // vector from camera to a primitive\n * const toCenterProj = Vector3.multiplyByScalar(direction, Vector3.dot(direction, toCenter), new Vector3()); // project vector onto camera direction vector\n * const distance = Vector3.magnitude(toCenterProj);\n * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, new Vector2());\n */\n getPixelDimensions(\n /** The width of the drawing buffer. */\n drawingBufferWidth: number,\n /** The height of the drawing buffer. */\n drawingBufferHeight: number,\n /** The distance to the near plane in meters. */\n distance: number,\n /** The object onto which to store the result. */\n result: Vector2\n ): Vector2 {\n this._update();\n\n assert(Number.isFinite(drawingBufferWidth) && Number.isFinite(drawingBufferHeight));\n // 'Both drawingBufferWidth and drawingBufferHeight are required.'\n assert(drawingBufferWidth > 0);\n // 'drawingBufferWidth must be greater than zero.'\n assert(drawingBufferHeight > 0);\n // 'drawingBufferHeight must be greater than zero.'\n assert(distance > 0);\n // 'distance is required.');\n assert(result);\n // 'A result object is required.');\n\n const inverseNear = 1.0 / this.near;\n let tanTheta = this.top * inverseNear;\n const pixelHeight = (2.0 * distance * tanTheta) / drawingBufferHeight;\n tanTheta = this.right * inverseNear;\n const pixelWidth = (2.0 * distance * tanTheta) / drawingBufferWidth;\n\n result.x = pixelWidth;\n result.y = pixelHeight;\n return result;\n }\n\n // eslint-disable-next-line complexity, max-statements\n private _update() {\n assert(\n Number.isFinite(this.right) &&\n Number.isFinite(this.left) &&\n Number.isFinite(this.top) &&\n Number.isFinite(this.bottom) &&\n Number.isFinite(this.near) &&\n Number.isFinite(this.far)\n );\n // throw new DeveloperError('right, left, top, bottom, near, or far parameters are not set.');\n\n const {top, bottom, right, left, near, far} = this;\n\n if (\n top !== this._top ||\n bottom !== this._bottom ||\n left !== this._left ||\n right !== this._right ||\n near !== this._near ||\n far !== this._far\n ) {\n assert(\n this.near > 0 && this.near < this.far,\n 'near must be greater than zero and less than far.'\n );\n\n this._left = left;\n this._right = right;\n this._top = top;\n this._bottom = bottom;\n this._near = near;\n this._far = far;\n this._perspectiveMatrix = new Matrix4().frustum({\n left,\n right,\n bottom,\n top,\n near,\n far\n });\n this._infinitePerspective = new Matrix4().frustum({\n left,\n right,\n bottom,\n top,\n near,\n far: Infinity\n });\n }\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// Note: This class is still an experimental export, mainly used by other test cases\n// - It has not been fully adapted to math.gl conventions\n// - Documentation has not been ported\n\nimport {NumericArray} from '@math.gl/types';\nimport {assert, Matrix4, Vector2} from '@math.gl/core';\nimport {PerspectiveOffCenterFrustum} from './perspective-off-center-frustum';\nimport {CullingVolume} from './culling-volume';\n\nconst defined = (val: unknown) => val !== null && typeof val !== 'undefined';\n\ntype PerspectiveFrustumOptions = {\n /** The angle of the field of view (FOV), in radians. */\n fov?: number;\n /** The aspect ratio of the frustum's width to it's height. */\n aspectRatio?: number;\n /** The distance of the near plane. */\n near?: number;\n /** The distance of the far plane. */\n far?: number;\n /** The offset in the x direction. */\n xOffset?: number;\n /** The offset in the y direction. */\n yOffset?: number;\n};\n\n/**\n * The viewing frustum is defined by 6 planes.\n * Each plane is represented by a {@link Vector4} object, where the x, y, and z components\n * define the unit vector normal to the plane, and the w component is the distance of the\n * plane from the origin/camera position.\n *\n * @alias PerspectiveFrustum\n *\n * @example\n * var frustum = new PerspectiveFrustum({\n * fov : Math.PI_OVER_THREE,\n * aspectRatio : canvas.clientWidth / canvas.clientHeight\n * near : 1.0,\n * far : 1000.0\n * });\n *\n * @see PerspectiveOffCenterFrustum\n */\nexport class PerspectiveFrustum {\n private _offCenterFrustum = new PerspectiveOffCenterFrustum();\n /**\n * The angle of the field of view (FOV), in radians. This angle will be used\n * as the horizontal FOV if the width is greater than the height, otherwise\n * it will be the vertical FOV.\n */\n fov?: number;\n private _fov: number;\n private _fovy: number;\n private _sseDenominator: number;\n /**\n * The aspect ratio of the frustum's width to it's height.\n */\n aspectRatio?: number;\n private _aspectRatio: number;\n /**\n * The distance of the near plane.\n * @default 1.0\n */\n near: number;\n private _near: number;\n /**\n * The distance of the far plane.\n * @default 500000000.0\n */\n far: number;\n private _far: number;\n /**\n * Offsets the frustum in the x direction.\n * @default 0.0\n */\n xOffset: number;\n private _xOffset: number;\n /**\n * Offsets the frustum in the y direction.\n * @default 0.0\n */\n yOffset: number;\n private _yOffset: number;\n\n constructor(options: PerspectiveFrustumOptions = {}) {\n const {fov, aspectRatio, near = 1.0, far = 500000000.0, xOffset = 0.0, yOffset = 0.0} = options;\n\n this.fov = fov;\n this.aspectRatio = aspectRatio;\n this.near = near;\n this.far = far;\n this.xOffset = xOffset;\n this.yOffset = yOffset;\n }\n\n /**\n * Returns a duplicate of a PerspectiveFrustum instance.\n */\n clone(): PerspectiveFrustum {\n return new PerspectiveFrustum({\n aspectRatio: this.aspectRatio,\n fov: this.fov,\n near: this.near,\n far: this.far\n });\n }\n\n /**\n * Compares the provided PerspectiveFrustum componentwise and returns\n * <code>true</code> if they are equal, <code>false</code> otherwise.\n */\n equals(other: PerspectiveFrustum): boolean {\n if (!defined(other) || !(other instanceof PerspectiveFrustum)) {\n return false;\n }\n\n this._update();\n other._update();\n\n return (\n this.fov === other.fov &&\n this.aspectRatio === other.aspectRatio &&\n this.near === other.near &&\n this.far === other.far &&\n this._offCenterFrustum.equals(other._offCenterFrustum)\n );\n }\n\n /**\n * Gets the perspective projection matrix computed from the view this.\n */\n get projectionMatrix(): Matrix4 {\n this._update();\n return this._offCenterFrustum.projectionMatrix;\n }\n\n /**\n * The perspective projection matrix computed from the view frustum with an infinite far plane.\n */\n get infiniteProjectionMatrix(): Matrix4 {\n this._update();\n return this._offCenterFrustum.infiniteProjectionMatrix;\n }\n\n /**\n * Gets the angle of the vertical field of view, in radians.\n */\n get fovy(): number {\n this._update();\n return this._fovy;\n }\n\n /**\n * @private\n */\n get sseDenominator(): number {\n this._update();\n return this._sseDenominator;\n }\n\n /**\n * Creates a culling volume for this this.ion.\n * @returns {CullingVolume} A culling volume at the given position and orientation.\n *\n * @example\n * // Check if a bounding volume intersects the this.\n * var cullingVolume = this.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);\n * var intersect = cullingVolume.computeVisibility(boundingVolume);\n */\n computeCullingVolume(\n /** A Vector3 defines the eye position. */\n position: Readonly<NumericArray>,\n /** A Vector3 defines the view direction. */\n direction: Readonly<NumericArray>,\n /** A Vector3 defines the up direction. */\n up: Readonly<NumericArray>\n ): CullingVolume {\n this._update();\n return this._offCenterFrustum.computeCullingVolume(position, direction, up);\n }\n\n /**\n * Returns the pixel's width and height in meters.\n * @returns {Vector2} The modified result parameter or a new instance of {@link Vector2} with the pixel's width and height in the x and y properties, respectively.\n *\n * @exception {DeveloperError} drawingBufferWidth must be greater than zero.\n * @exception {DeveloperError} drawingBufferHeight must be greater than zero.\n *\n * @example\n * // Example 1\n * // Get the width and height of a pixel.\n * var pixelSize = camera.this.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, new Vector2());\n *\n * @example\n * // Example 2\n * // Get the width and height of a pixel if the near plane was set to 'distance'.\n * // For example, get the size of a pixel of an image on a billboard.\n * var position = camera.position;\n * var direction = camera.direction;\n * var toCenter = Vector3.subtract(primitive.boundingVolume.center, position, new Vector3()); // vector from camera to a primitive\n * var toCenterProj = Vector3.multiplyByScalar(direction, Vector3.dot(direction, toCenter), new Vector3()); // project vector onto camera direction vector\n * var distance = Vector3.magnitude(toCenterProj);\n * var pixelSize = camera.this.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, new Vector2());\n */\n getPixelDimensions(\n /** The width of the drawing buffer. */\n drawingBufferWidth: number,\n /** The height of the drawing buffer. */\n drawingBufferHeight: number,\n /** The distance to the near plane in meters. */\n distance: number,\n /** The object onto which to store the result. */\n result?: Vector2\n ): Vector2 {\n this._update();\n return this._offCenterFrustum.getPixelDimensions(\n drawingBufferWidth,\n drawingBufferHeight,\n distance,\n result || new Vector2()\n );\n }\n\n // eslint-disable-next-line complexity, max-statements\n private _update(): void {\n assert(\n Number.isFinite(this.fov) &&\n Number.isFinite(this.aspectRatio) &&\n Number.isFinite(this.near) &&\n Number.isFinite(this.far)\n );\n // 'fov, aspectRatio, near, or far parameters are not set.'\n\n const f = this._offCenterFrustum;\n\n if (\n this.fov !== this._fov ||\n this.aspectRatio !== this._aspectRatio ||\n this.near !== this._near ||\n this.far !== this._far ||\n this.xOffset !== this._xOffset ||\n this.yOffset !== this._yOffset\n ) {\n assert(this.fov >= 0 && this.fov < Math.PI);\n // throw new DeveloperError('fov must be in the range [0, PI).');\n\n assert(this.aspectRatio > 0);\n // throw new DeveloperError('aspectRatio must be positive.');\n\n assert(this.near >= 0 && this.near < this.far);\n // throw new DeveloperError('near must be greater than zero and less than far.');\n\n this._aspectRatio = this.aspectRatio;\n this._fov = this.fov;\n this._fovy =\n this.aspectRatio <= 1\n ? this.fov\n : Math.atan(Math.tan(this.fov * 0.5) / this.aspectRatio) * 2.0;\n this._near = this.near;\n this._far = this.far;\n this._sseDenominator = 2.0 * Math.tan(0.5 * this._fovy);\n this._xOffset = this.xOffset;\n this._yOffset = this.yOffset;\n\n f.top = this.near * Math.tan(0.5 * this._fovy);\n f.bottom = -f.top;\n f.right = this.aspectRatio * f.top;\n f.left = -f.right;\n f.near = this.near;\n f.far = this.far;\n\n f.right += this.xOffset;\n f.left += this.xOffset;\n f.top += this.yOffset;\n f.bottom += this.yOffset;\n }\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector3} from '@math.gl/core';\nimport {BoundingSphere} from '../bounding-volumes/bounding-sphere';\n\n/* eslint-disable */\nconst fromPointsXMin = new Vector3();\nconst fromPointsYMin = new Vector3();\nconst fromPointsZMin = new Vector3();\nconst fromPointsXMax = new Vector3();\nconst fromPointsYMax = new Vector3();\nconst fromPointsZMax = new Vector3();\nconst fromPointsCurrentPos = new Vector3();\nconst fromPointsScratch = new Vector3();\nconst fromPointsRitterCenter = new Vector3();\nconst fromPointsMinBoxPt = new Vector3();\nconst fromPointsMaxBoxPt = new Vector3();\nconst fromPointsNaiveCenterScratch = new Vector3();\n// const volumeConstant = (4.0 / 3.0) * Math.PI;\n\n/**\n * Computes a tight-fitting bounding sphere enclosing a list of 3D Cartesian points.\n *\n * The bounding sphere is computed by running two algorithms, a naive algorithm and\n * Ritter's algorithm. The smaller of the two spheres is used to ensure a tight fit.\n * Bounding sphere computation article http://blogs.agi.com/insight3d/index.php/2008/02/04/a-bounding\n *\n * @param positions An array of points that the bounding sphere will enclose.\n * @param result Optional object onto which to store the result.\n * @returns The modified result parameter or a new `BoundingSphere` instance if not provided.\n */\nexport function makeBoundingSphereFromPoints(\n positions: number[][],\n result: BoundingSphere = new BoundingSphere()\n): BoundingSphere {\n if (!positions || positions.length === 0) {\n return result.fromCenterRadius([0, 0, 0], 0);\n }\n\n const currentPos = fromPointsCurrentPos.copy(positions[0]);\n\n const xMin = fromPointsXMin.copy(currentPos);\n const yMin = fromPointsYMin.copy(currentPos);\n const zMin = fromPointsZMin.copy(currentPos);\n\n const xMax = fromPointsXMax.copy(currentPos);\n const yMax = fromPointsYMax.copy(currentPos);\n const zMax = fromPointsZMax.copy(currentPos);\n\n for (const position of positions) {\n currentPos.copy(position);\n\n const x = currentPos.x;\n const y = currentPos.y;\n const z = currentPos.z;\n\n // Store points containing the the smallest and largest components\n if (x < xMin.x) {\n xMin.copy(currentPos);\n }\n\n if (x > xMax.x) {\n xMax.copy(currentPos);\n }\n\n if (y < yMin.y) {\n yMin.copy(currentPos);\n }\n\n if (y > yMax.y) {\n yMax.copy(currentPos);\n }\n\n if (z < zMin.z) {\n zMin.copy(currentPos);\n }\n\n if (z > zMax.z) {\n zMax.copy(currentPos);\n }\n }\n\n // Compute x-, y-, and z-spans (Squared distances b/n each component's min. and max.).\n const xSpan = fromPointsScratch.copy(xMax).subtract(xMin).magnitudeSquared();\n const ySpan = fromPointsScratch.copy(yMax).subtract(yMin).magnitudeSquared();\n const zSpan = fromPointsScratch.copy(zMax).subtract(zMin).magnitudeSquared();\n\n // Set the diameter endpoints to the largest span.\n let diameter1 = xMin;\n let diameter2 = xMax;\n let maxSpan = xSpan;\n if (ySpan > maxSpan) {\n maxSpan = ySpan;\n diameter1 = yMin;\n diameter2 = yMax;\n }\n if (zSpan > maxSpan) {\n maxSpan = zSpan;\n diameter1 = zMin;\n diameter2 = zMax;\n }\n\n // Calculate the center of the initial sphere found by Ritter's algorithm\n const ritterCenter = fromPointsRitterCenter;\n ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;\n ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;\n ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;\n\n // Calculate the radius of the initial sphere found by Ritter's algorithm\n let radiusSquared = fromPointsScratch.copy(diameter2).subtract(ritterCenter).magnitudeSquared();\n let ritterRadius = Math.sqrt(radiusSquared);\n\n // Find the center of the sphere found using the Naive method.\n const minBoxPt = fromPointsMinBoxPt;\n minBoxPt.x = xMin.x;\n minBoxPt.y = yMin.y;\n minBoxPt.z = zMin.z;\n\n const maxBoxPt = fromPointsMaxBoxPt;\n maxBoxPt.x = xMax.x;\n maxBoxPt.y = yMax.y;\n maxBoxPt.z = zMax.z;\n\n const naiveCenter = fromPointsNaiveCenterScratch\n .copy(minBoxPt)\n .add(maxBoxPt)\n .multiplyByScalar(0.5);\n\n // Begin 2nd pass to find naive radius and modify the ritter sphere.\n let naiveRadius = 0;\n for (const position of positions) {\n currentPos.copy(position);\n\n // Find the furthest point from the naive center to calculate the naive radius.\n const r = fromPointsScratch.copy(currentPos).subtract(naiveCenter).magnitude();\n if (r > naiveRadius) {\n naiveRadius = r;\n }\n\n // Make adjustments to the Ritter Sphere to include all points.\n const oldCenterToPointSquared = fromPointsScratch\n .copy(currentPos)\n .subtract(ritterCenter)\n .magnitudeSquared();\n\n if (oldCenterToPointSquared > radiusSquared) {\n const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);\n // Calculate new radius to include the point that lies outside\n ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;\n radiusSquared = ritterRadius * ritterRadius;\n // Calculate center of new Ritter sphere\n const oldToNew = oldCenterToPoint - ritterRadius;\n ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;\n ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;\n ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;\n }\n }\n\n if (ritterRadius < naiveRadius) {\n ritterCenter.to(result.center);\n result.radius = ritterRadius;\n } else {\n naiveCenter.to(result.center);\n result.radius = naiveRadius;\n }\n\n return result;\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector3, Matrix3} from '@math.gl/core';\nimport {computeEigenDecomposition} from './compute-eigen-decomposition';\nimport {OrientedBoundingBox} from '../bounding-volumes/oriented-bounding-box';\nimport {AxisAlignedBoundingBox} from '../bounding-volumes/axis-aligned-bounding-box';\n\nconst scratchVector2 = new Vector3();\n\nconst scratchVector3 = new Vector3();\n\nconst scratchVector4 = new Vector3();\n\nconst scratchVector5 = new Vector3();\n\nconst scratchVector6 = new Vector3();\n\nconst scratchCovarianceResult = new Matrix3();\n\nconst scratchEigenResult = {\n diagonal: new Matrix3(),\n unitary: new Matrix3()\n};\n\n/**\n * Computes an instance of an OrientedBoundingBox of the given positions.\n *\n * This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis).\n * Reference: http://gamma.cs.unc.edu/users/gottschalk/main.pdf\n */\n/* eslint-disable max-statements */\nexport function makeOrientedBoundingBoxFromPoints(\n positions: number[][],\n result: OrientedBoundingBox = new OrientedBoundingBox()\n): OrientedBoundingBox {\n if (!positions || positions.length === 0) {\n result.halfAxes = new Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);\n result.center = new Vector3();\n return result;\n }\n\n const length = positions.length;\n const meanPoint = new Vector3(0, 0, 0);\n for (const position of positions) {\n meanPoint.add(position);\n }\n const invLength = 1.0 / length;\n meanPoint.multiplyByScalar(invLength);\n\n let exx = 0.0;\n let exy = 0.0;\n let exz = 0.0;\n let eyy = 0.0;\n let eyz = 0.0;\n let ezz = 0.0;\n\n for (const position of positions) {\n const p = scratchVector2.copy(position).subtract(meanPoint);\n exx += p.x * p.x;\n exy += p.x * p.y;\n exz += p.x * p.z;\n eyy += p.y * p.y;\n eyz += p.y * p.z;\n ezz += p.z * p.z;\n }\n\n exx *= invLength;\n exy *= invLength;\n exz *= invLength;\n eyy *= invLength;\n eyz *= invLength;\n ezz *= invLength;\n\n const covarianceMatrix = scratchCovarianceResult;\n covarianceMatrix[0] = exx;\n covarianceMatrix[1] = exy;\n covarianceMatrix[2] = exz;\n covarianceMatrix[3] = exy;\n covarianceMatrix[4] = eyy;\n covarianceMatrix[5] = eyz;\n covarianceMatrix[6] = exz;\n covarianceMatrix[7] = eyz;\n covarianceMatrix[8] = ezz;\n\n const {unitary} = computeEigenDecomposition(covarianceMatrix, scratchEigenResult);\n const rotation = result.halfAxes.copy(unitary);\n\n let v1 = rotation.getColumn(0, scratchVector4);\n let v2 = rotation.getColumn(1, scratchVector5);\n let v3 = rotation.getColumn(2, scratchVector6);\n\n let u1 = -Number.MAX_VALUE;\n let u2 = -Number.MAX_VALUE;\n let u3 = -Number.MAX_VALUE;\n let l1 = Number.MAX_VALUE;\n let l2 = Number.MAX_VALUE;\n let l3 = Number.MAX_VALUE;\n\n for (const position of positions) {\n scratchVector2.copy(position);\n\n u1 = Math.max(scratchVector2.dot(v1), u1);\n u2 = Math.max(scratchVector2.dot(v2), u2);\n u3 = Math.max(scratchVector2.dot(v3), u3);\n\n l1 = Math.min(scratchVector2.dot(v1), l1);\n l2 = Math.min(scratchVector2.dot(v2), l2);\n l3 = Math.min(scratchVector2.dot(v3), l3);\n }\n\n v1 = v1.multiplyByScalar(0.5 * (l1 + u1));\n v2 = v2.multiplyByScalar(0.5 * (l2 + u2));\n v3 = v3.multiplyByScalar(0.5 * (l3 + u3));\n\n result.center.copy(v1).add(v2).add(v3);\n\n const scale = scratchVector3.set(u1 - l1, u2 - l2, u3 - l3).multiplyByScalar(0.5);\n const scaleMatrix = new Matrix3([scale[0], 0, 0, 0, scale[1], 0, 0, 0, scale[2]]);\n result.halfAxes.multiplyRight(scaleMatrix);\n\n return result;\n}\n\n/**\n * Computes an instance of an AxisAlignedBoundingBox. The box is determined by\n * finding the points spaced the farthest apart on the x, y, and z axes.\n */\nexport function makeAxisAlignedBoundingBoxFromPoints(\n positions: readonly number[][],\n result: AxisAlignedBoundingBox = new AxisAlignedBoundingBox()\n): AxisAlignedBoundingBox {\n if (!positions || positions.length === 0) {\n result.minimum.set(0, 0, 0);\n result.maximum.set(0, 0, 0);\n result.center.set(0, 0, 0);\n result.halfDiagonal.set(0, 0, 0);\n return result;\n }\n\n let minimumX = positions[0][0];\n let minimumY = positions[0][1];\n let minimumZ = positions[0][2];\n\n let maximumX = positions[0][0];\n let maximumY = positions[0][1];\n let maximumZ = positions[0][2];\n\n for (const p of positions) {\n const x = p[0];\n const y = p[1];\n const z = p[2];\n\n minimumX = Math.min(x, minimumX);\n maximumX = Math.max(x, maximumX);\n minimumY = Math.min(y, minimumY);\n maximumY = Math.max(y, maximumY);\n minimumZ = Math.min(z, minimumZ);\n maximumZ = Math.max(z, maximumZ);\n }\n\n result.minimum.set(minimumX, minimumY, minimumZ);\n result.maximum.set(maximumX, maximumY, maximumZ);\n result.center.copy(result.minimum).add(result.maximum).scale(0.5);\n result.halfDiagonal.copy(result.maximum).subtract(result.center);\n\n return result;\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Matrix3, _MathUtils} from '@math.gl/core';\n\nconst scratchMatrix = new Matrix3();\nconst scratchUnitary = new Matrix3();\nconst scratchDiagonal = new Matrix3();\n\nconst jMatrix = new Matrix3();\nconst jMatrixTranspose = new Matrix3();\n\nexport type EigenDecomposition = {\n unitary: Matrix3;\n diagonal: Matrix3;\n};\n\n/**\n * Computes the eigenvectors and eigenvalues of a symmetric matrix.\n *\n * - Returns a diagonal matrix and unitary matrix such that:\n * `matrix = unitary matrix * diagonal matrix * transpose(unitary matrix)`\n * - The values along the diagonal of the diagonal matrix are the eigenvalues. The columns\n * of the unitary matrix are the corresponding eigenvectors.\n * - This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan,\n * section 8.4.3 The Classical Jacobi Algorithm\n *\n * @param matrix The 3x3 matrix to decompose into diagonal and unitary matrix. Expected to be symmetric.\n * @param result Optional object with unitary and diagonal properties which are matrices onto which to store the result.\n * @returns An object with unitary and diagonal properties which are the unitary and diagonal matrices, respectively.\n *\n * @example\n * const a = //... symmetric matrix\n * const result = {\n * unitary : new Matrix3(),\n * diagonal : new Matrix3()\n * };\n * computeEigenDecomposition(a, result);\n *\n * const unitaryTranspose = Matrix3.transpose(result.unitary, new Matrix3());\n * const b = Matrix3.multiply(result.unitary, result.diagonal, new Matrix3());\n * Matrix3.multiply(b, unitaryTranspose, b); // b is now equal to a\n *\n * const lambda = result.diagonal.getColumn(0, new Vector3()).x; // first eigenvalue\n * const v = result.unitary.getColumn(0, new Vector3()); // first eigenvector\n * const c = v.multiplyByScalar(lambda); // equal to v.transformByMatrix3(a)\n */\nexport function computeEigenDecomposition(\n matrix: number[],\n // @ts-expect-error accept empty object type\n result: EigenDecomposition = {}\n): EigenDecomposition {\n const EIGEN_TOLERANCE = _MathUtils.EPSILON20;\n const EIGEN_MAX_SWEEPS = 10;\n\n let count = 0;\n let sweep = 0;\n\n const unitaryMatrix = scratchUnitary;\n const diagonalMatrix = scratchDiagonal;\n\n unitaryMatrix.identity();\n diagonalMatrix.copy(matrix);\n\n const epsilon = EIGEN_TOLERANCE * computeFrobeniusNorm(diagonalMatrix);\n\n while (sweep < EIGEN_MAX_SWEEPS && offDiagonalFrobeniusNorm(diagonalMatrix) > epsilon) {\n shurDecomposition(diagonalMatrix, jMatrix);\n\n jMatrixTranspose.copy(jMatrix).transpose();\n\n diagonalMatrix.multiplyRight(jMatrix);\n diagonalMatrix.multiplyLeft(jMatrixTranspose);\n unitaryMatrix.multiplyRight(jMatrix);\n\n if (++count > 2) {\n ++sweep;\n count = 0;\n }\n }\n\n result.unitary = unitaryMatrix.toTarget(result.unitary);\n result.diagonal = diagonalMatrix.toTarget(result.diagonal);\n\n return result;\n}\n\nfunction computeFrobeniusNorm(matrix: Matrix3): number {\n let norm = 0.0;\n for (let i = 0; i < 9; ++i) {\n const temp = matrix[i];\n norm += temp * temp;\n }\n return Math.sqrt(norm);\n}\n\nconst rowVal = [1, 0, 0];\nconst colVal = [2, 2, 1];\n\n// Computes the \"off-diagonal\" Frobenius norm.\n// Assumes matrix is symmetric.\nfunction offDiagonalFrobeniusNorm(matrix: Matrix3): number {\n let norm = 0.0;\n for (let i = 0; i < 3; ++i) {\n const temp = matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])];\n norm += 2.0 * temp * temp;\n }\n return Math.sqrt(norm);\n}\n\n// The routine takes a matrix, which is assumed to be symmetric, and\n// finds the largest off-diagonal term, and then creates\n// a matrix (result) which can be used to help reduce it\n//\n// This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan,\n// section 8.4.2 The 2by2 Symmetric Schur Decomposition.\n//\n// eslint-disable-next-line max-statements\nfunction shurDecomposition(matrix: Matrix3, result: Matrix3): Matrix3 {\n const tolerance = _MathUtils.EPSILON15;\n\n let maxDiagonal = 0.0;\n let rotAxis = 1;\n\n // find pivot (rotAxis) based on max diagonal of matrix\n for (let i = 0; i < 3; ++i) {\n const temp = Math.abs(matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])]);\n if (temp > maxDiagonal) {\n rotAxis = i;\n maxDiagonal = temp;\n }\n }\n\n const p = rowVal[rotAxis];\n const q = colVal[rotAxis];\n\n let c = 1.0;\n let s = 0.0;\n\n if (Math.abs(matrix[scratchMatrix.getElementIndex(q, p)]) > tolerance) {\n const qq = matrix[scratchMatrix.getElementIndex(q, q)];\n const pp = matrix[scratchMatrix.getElementIndex(p, p)];\n const qp = matrix[scratchMatrix.getElementIndex(q, p)];\n\n const tau = (qq - pp) / 2.0 / qp;\n let t;\n\n if (tau < 0.0) {\n t = -1.0 / (-tau + Math.sqrt(1.0 + tau * tau));\n } else {\n t = 1.0 / (tau + Math.sqrt(1.0 + tau * tau));\n }\n\n c = 1.0 / Math.sqrt(1.0 + t * t);\n s = t * c;\n }\n\n // Copy into result\n Matrix3.IDENTITY.to(result);\n result[scratchMatrix.getElementIndex(p, p)] = result[scratchMatrix.getElementIndex(q, q)] = c;\n result[scratchMatrix.getElementIndex(q, p)] = s;\n result[scratchMatrix.getElementIndex(p, q)] = -s;\n\n return result;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;ACIO,IAAM,eAAe;EAC1B,SAAS;;EACT,cAAc;;EACd,QAAQ;;;;;ACFV,kBAAsB;AAItB,IAAM,gBAAgB,IAAI,oBAAO;AACjC,IAAM,gBAAgB,IAAI,oBAAO;AAQ3B,IAAO,yBAAP,MAA6B;;;;;;;EAgBjC,YACE,UAA6B,CAAC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AG,QAAQ;AAC/B,eAAW,KAAK,IAAI,GAAG,QAAQ;EACjC;AAEA,SAAO,QAAQ,IAAI,UAAU,UAAU,QAAQ;AAC/C,SAAO,QAAQ,IAAI,UAAU,UAAU,QAAQ;AAC/C,SAAO,OAAO,KAAK,OAAO,OAAO,EAAE,IAAI,OAAO,OAAO,EAAE,MAAM,GAAG;AAChE,SAAO,aAAa,KAAK,OAAO,OAAO,EAAE,SAAS,OAAO,MAAM;AAE/D,SAAO;AACT;",
6
- "names": ["import_core", "scratchVector", "scratchVector2", "import_core", "import_core", "import_core", "scratchNormal", "import_core", "scratchPlaneNormal", "import_core", "import_core", "import_core", "import_core", "scratchVector2", "scratchVector3"]
3
+ "sources": ["../src/index.ts", "../src/constants.ts", "../src/lib/bounding-volumes/axis-aligned-bounding-box.ts", "../src/lib/bounding-volumes/bounding-sphere.ts", "../src/lib/bounding-volumes/oriented-bounding-box.ts", "../src/lib/culling-volume.ts", "../src/lib/plane.ts", "../src/lib/ray.ts", "../src/lib/perspective-off-center-frustum.ts", "../src/lib/perspective-frustum.ts", "../src/lib/algorithms/bounding-sphere-from-points.ts", "../src/lib/algorithms/bounding-box-from-points.ts", "../src/lib/algorithms/compute-eigen-decomposition.ts"],
4
+ "sourcesContent": ["// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport {INTERSECTION} from './constants';\n\nexport {AxisAlignedBoundingBox} from './lib/bounding-volumes/axis-aligned-bounding-box';\nexport {BoundingSphere} from './lib/bounding-volumes/bounding-sphere';\nexport {OrientedBoundingBox} from './lib/bounding-volumes/oriented-bounding-box';\nexport {CullingVolume} from './lib/culling-volume';\nexport {Plane} from './lib/plane';\nexport {Ray} from './lib/ray';\n\nexport {PerspectiveOffCenterFrustum as _PerspectiveOffCenterFrustum} from './lib/perspective-off-center-frustum';\nexport {PerspectiveFrustum as _PerspectiveFrustum} from './lib/perspective-frustum';\n\nexport {makeBoundingSphereFromPoints} from './lib/algorithms/bounding-sphere-from-points';\nexport {\n makeAxisAlignedBoundingBoxFromPoints,\n makeOrientedBoundingBoxFromPoints\n} from './lib/algorithms/bounding-box-from-points';\nexport {computeEigenDecomposition} from './lib/algorithms/compute-eigen-decomposition';\n", "// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport const INTERSECTION = {\n OUTSIDE: -1, // Represents that an object is not contained within the frustum.\n INTERSECTING: 0, // Represents that an object intersects one of the frustum's planes.\n INSIDE: 1 // Represents that an object is fully within the frustum.\n} as const;\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\nimport {BoundingVolume} from './bounding-volume';\nimport {Vector3} from '@math.gl/core';\nimport {Plane} from '../plane';\nimport {INTERSECTION} from '../../constants';\n\nconst scratchVector = new Vector3();\nconst scratchNormal = new Vector3();\n\n/**\n * An axis aligned bounding box - aligned with coordinate axes\n * @see BoundingVolume\n * @see BoundingRectangle\n * @see OrientedBoundingBox\n */\nexport class AxisAlignedBoundingBox implements BoundingVolume {\n /** The center point of the bounding box. */\n readonly center: Vector3;\n /** The positive half diagonal of the bounding box. */\n readonly halfDiagonal: Vector3;\n /** The minimum point defining the bounding box. [0, 0, 0] for empty box */\n readonly minimum: Vector3;\n /** The maximum point defining the bounding box. [0, 0, 0] for empty box */\n readonly maximum: Vector3;\n\n /**\n * Creates an instance of an AxisAlignedBoundingBox from the minimum and maximum points along the x, y, and z axes.\n * @param minimum=[0, 0, 0] The minimum point along the x, y, and z axes.\n * @param maximum=[0, 0, 0] The maximum point along the x, y, and z axes.\n * @param center The center of the box; automatically computed if not supplied.\n */\n constructor(\n minimum: readonly number[] = [0, 0, 0],\n maximum: readonly number[] = [0, 0, 0],\n center?: readonly number[]\n ) {\n // If center was not defined, compute it.\n center = center || scratchVector.copy(minimum).add(maximum).scale(0.5);\n this.center = new Vector3(center);\n this.halfDiagonal = new Vector3(maximum).subtract(this.center);\n\n /**\n * The minimum point defining the bounding box.\n * @type {Vector3}\n * @default {@link 0, 0, 0}\n */\n this.minimum = new Vector3(minimum);\n\n /**\n * The maximum point defining the bounding box.\n * @type {Vector3}\n * @default {@link 0, 0, 0}\n */\n this.maximum = new Vector3(maximum);\n }\n\n /**\n * Duplicates a AxisAlignedBoundingBox instance.\n *\n * @returns {AxisAlignedBoundingBox} A new AxisAlignedBoundingBox instance.\n */\n clone(): AxisAlignedBoundingBox {\n return new AxisAlignedBoundingBox(this.minimum, this.maximum, this.center);\n }\n\n /**\n * Compares the provided AxisAlignedBoundingBox componentwise and returns\n * <code>true</code> if they are equal, <code>false</code> otherwise.\n *\n * @param {AxisAlignedBoundingBox} [right] The second AxisAlignedBoundingBox to compare with.\n * @returns {Boolean} <code>true</code> if left and right are equal, <code>false</code> otherwise.\n */\n equals(right: AxisAlignedBoundingBox): boolean {\n return (\n this === right ||\n (Boolean(right) && this.minimum.equals(right.minimum) && this.maximum.equals(right.maximum))\n );\n }\n\n /**\n * Applies a 4x4 affine transformation matrix to a bounding sphere.\n * @param transform The transformation matrix to apply to the bounding sphere.\n * @returns itself, i.e. the modified BoundingVolume.\n */\n transform(transform: readonly number[]): this {\n this.center.transformAsPoint(transform);\n // TODO - this.halfDiagonal.transformAsVector(transform);\n this.halfDiagonal.transform(transform);\n this.minimum.transform(transform);\n this.maximum.transform(transform);\n return this;\n }\n\n /**\n * Determines which side of a plane a box is located.\n */\n intersectPlane(plane: Plane): number {\n const {halfDiagonal} = this;\n const normal = scratchNormal.from(plane.normal);\n const e =\n halfDiagonal.x * Math.abs(normal.x) +\n halfDiagonal.y * Math.abs(normal.y) +\n halfDiagonal.z * Math.abs(normal.z);\n const s = this.center.dot(normal) + plane.distance; // signed distance from center\n\n if (s - e > 0) {\n return INTERSECTION.INSIDE;\n }\n\n if (s + e < 0) {\n // Not in front because normals point inward\n return INTERSECTION.OUTSIDE;\n }\n\n return INTERSECTION.INTERSECTING;\n }\n\n /** Computes the estimated distance from the closest point on a bounding box to a point. */\n distanceTo(point: readonly number[]): number {\n return Math.sqrt(this.distanceSquaredTo(point));\n }\n\n /** Computes the estimated distance squared from the closest point on a bounding box to a point. */\n distanceSquaredTo(point: readonly number[]): number {\n const offset = scratchVector.from(point).subtract(this.center);\n const {halfDiagonal} = this;\n\n let distanceSquared = 0.0;\n let d;\n\n d = Math.abs(offset.x) - halfDiagonal.x;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n d = Math.abs(offset.y) - halfDiagonal.y;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n d = Math.abs(offset.z) - halfDiagonal.z;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n return distanceSquared;\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {NumericArray, Vector3, mat4} from '@math.gl/core';\n\nimport {INTERSECTION} from '../../constants';\nimport {BoundingVolume} from './bounding-volume';\nimport {Plane} from '../plane';\n\nconst scratchVector = new Vector3();\nconst scratchVector2 = new Vector3();\n\n/** A BoundingSphere */\nexport class BoundingSphere implements BoundingVolume {\n center: Vector3;\n radius: number;\n\n /** Creates a bounding sphere */\n constructor(center: readonly number[] = [0, 0, 0], radius: number = 0.0) {\n this.radius = -0;\n this.center = new Vector3();\n this.fromCenterRadius(center, radius);\n }\n\n /** Sets the bounding sphere from `center` and `radius`. */\n fromCenterRadius(center: readonly number[], radius: number): this {\n this.center.from(center);\n this.radius = radius;\n return this;\n }\n\n /**\n * Computes a bounding sphere from the corner points of an axis-aligned bounding box. The sphere\n * tightly and fully encompasses the box.\n */\n fromCornerPoints(corner: readonly number[], oppositeCorner: readonly number[]): this {\n oppositeCorner = scratchVector.from(oppositeCorner);\n this.center = new Vector3().from(corner).add(oppositeCorner).scale(0.5);\n this.radius = this.center.distance(oppositeCorner);\n return this;\n }\n\n /** Compares the provided BoundingSphere component wise */\n equals(right: BoundingSphere): boolean {\n return (\n this === right ||\n (Boolean(right) && this.center.equals(right.center) && this.radius === right.radius)\n );\n }\n\n /** Duplicates a BoundingSphere instance. */\n clone(): BoundingSphere {\n return new BoundingSphere(this.center, this.radius);\n }\n\n /** Computes a bounding sphere that contains both the left and right bounding spheres. */\n union(boundingSphere: BoundingSphere): BoundingSphere {\n const leftCenter = this.center;\n const leftRadius = this.radius;\n const rightCenter = boundingSphere.center;\n const rightRadius = boundingSphere.radius;\n\n const toRightCenter = scratchVector.copy(rightCenter).subtract(leftCenter);\n const centerSeparation = toRightCenter.magnitude();\n\n if (leftRadius >= centerSeparation + rightRadius) {\n // Left sphere wins.\n return this.clone();\n }\n\n if (rightRadius >= centerSeparation + leftRadius) {\n // Right sphere wins.\n return boundingSphere.clone();\n }\n\n // There are two tangent points, one on far side of each sphere.\n const halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;\n\n // Compute the center point halfway between the two tangent points.\n scratchVector2\n .copy(toRightCenter)\n .scale((-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation)\n .add(leftCenter);\n\n this.center.copy(scratchVector2);\n this.radius = halfDistanceBetweenTangentPoints;\n\n return this;\n }\n\n /** Computes a bounding sphere by enlarging the provided sphere to contain the provided point. */\n expand(point: readonly number[]): this {\n const scratchPoint = scratchVector.from(point);\n const radius = scratchPoint.subtract(this.center).magnitude();\n if (radius > this.radius) {\n this.radius = radius;\n }\n return this;\n }\n\n // BoundingVolume interface\n\n /**\n * Applies a 4x4 affine transformation matrix to a bounding sphere.\n * @param sphere The bounding sphere to apply the transformation to.\n * @param transform The transformation matrix to apply to the bounding sphere.\n * @returns self.\n */\n transform(transform: readonly number[]): this {\n this.center.transform(transform);\n const scale = mat4.getScaling(scratchVector, transform);\n this.radius = Math.max(scale[0], Math.max(scale[1], scale[2])) * this.radius;\n return this;\n }\n\n /** Computes the estimated distance squared from the closest point on a bounding sphere to a point. */\n distanceSquaredTo(point: Readonly<NumericArray>): number {\n const d = this.distanceTo(point);\n return d * d;\n }\n\n /** Computes the estimated distance from the closest point on a bounding sphere to a point. */\n distanceTo(point: Readonly<NumericArray>): number {\n const scratchPoint = scratchVector.from(point);\n const delta = scratchPoint.subtract(this.center);\n return Math.max(0, delta.len() - this.radius);\n }\n\n /** Determines which side of a plane a sphere is located. */\n intersectPlane(plane: Plane): number {\n const center = this.center;\n const radius = this.radius;\n const normal = plane.normal;\n const distanceToPlane = normal.dot(center) + plane.distance;\n\n // The center point is negative side of the plane normal\n if (distanceToPlane < -radius) {\n return INTERSECTION.OUTSIDE;\n }\n // The center point is positive side of the plane, but radius extends beyond it; partial overlap\n if (distanceToPlane < radius) {\n return INTERSECTION.INTERSECTING;\n }\n // The center point and radius is positive side of the plane\n return INTERSECTION.INSIDE;\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {NumericArray} from '@math.gl/types';\nimport {Vector3, Matrix3, Matrix4, Quaternion} from '@math.gl/core';\n\nimport type {BoundingVolume} from './bounding-volume';\nimport {BoundingSphere} from './bounding-sphere';\nimport {Plane} from '../plane';\nimport {INTERSECTION} from '../../constants';\n\nconst scratchVector3 = new Vector3();\nconst scratchOffset = new Vector3();\nconst scratchVectorU = new Vector3();\nconst scratchVectorV = new Vector3();\nconst scratchVectorW = new Vector3();\nconst scratchCorner = new Vector3();\nconst scratchToCenter = new Vector3();\n\nconst MATRIX3 = {\n COLUMN0ROW0: 0,\n COLUMN0ROW1: 1,\n COLUMN0ROW2: 2,\n COLUMN1ROW0: 3,\n COLUMN1ROW1: 4,\n COLUMN1ROW2: 5,\n COLUMN2ROW0: 6,\n COLUMN2ROW1: 7,\n COLUMN2ROW2: 8\n};\n\n/**\n * An OrientedBoundingBox of some object is a closed and convex cuboid.\n * It can provide a tighter bounding volume than `BoundingSphere` or\n * `AxisAlignedBoundingBox` in many cases.\n */\nexport class OrientedBoundingBox implements BoundingVolume {\n center: Vector3;\n halfAxes: Matrix3;\n\n /**\n * An OrientedBoundingBox of some object is a closed and convex cuboid.\n * It can provide a tighter bounding volume than\n * `BoundingSphere` or `AxisAlignedBoundingBox` in many cases.\n */\n constructor(center?: Readonly<NumericArray>, halfAxes?: Readonly<NumericArray>);\n constructor(\n center: Readonly<NumericArray> = [0, 0, 0],\n halfAxes: Readonly<NumericArray> = [0, 0, 0, 0, 0, 0, 0, 0, 0]\n ) {\n this.center = new Vector3().from(center);\n this.halfAxes = new Matrix3(halfAxes);\n }\n\n /** Returns an array with three halfSizes for the bounding box */\n get halfSize(): number[] {\n const xAxis = this.halfAxes.getColumn(0);\n const yAxis = this.halfAxes.getColumn(1);\n const zAxis = this.halfAxes.getColumn(2);\n return [new Vector3(xAxis).len(), new Vector3(yAxis).len(), new Vector3(zAxis).len()];\n }\n\n /** Returns a quaternion describing the orientation of the bounding box */\n get quaternion(): Quaternion {\n const xAxis = this.halfAxes.getColumn(0);\n const yAxis = this.halfAxes.getColumn(1);\n const zAxis = this.halfAxes.getColumn(2);\n const normXAxis = new Vector3(xAxis).normalize();\n const normYAxis = new Vector3(yAxis).normalize();\n const normZAxis = new Vector3(zAxis).normalize();\n return new Quaternion().fromMatrix3(new Matrix3([...normXAxis, ...normYAxis, ...normZAxis]));\n }\n\n /**\n * Create OrientedBoundingBox from quaternion based OBB,\n */\n fromCenterHalfSizeQuaternion(\n center: number[],\n halfSize: number[],\n quaternion: number[]\n ): OrientedBoundingBox {\n const quaternionObject = new Quaternion(quaternion);\n const directionsMatrix = new Matrix3().fromQuaternion(quaternionObject);\n directionsMatrix[0] = directionsMatrix[0] * halfSize[0];\n directionsMatrix[1] = directionsMatrix[1] * halfSize[0];\n directionsMatrix[2] = directionsMatrix[2] * halfSize[0];\n directionsMatrix[3] = directionsMatrix[3] * halfSize[1];\n directionsMatrix[4] = directionsMatrix[4] * halfSize[1];\n directionsMatrix[5] = directionsMatrix[5] * halfSize[1];\n directionsMatrix[6] = directionsMatrix[6] * halfSize[2];\n directionsMatrix[7] = directionsMatrix[7] * halfSize[2];\n directionsMatrix[8] = directionsMatrix[8] * halfSize[2];\n this.center = new Vector3().from(center);\n this.halfAxes = directionsMatrix;\n return this;\n }\n\n /** Duplicates a OrientedBoundingBox instance. */\n clone(): OrientedBoundingBox {\n return new OrientedBoundingBox(this.center, this.halfAxes);\n }\n\n /** Compares the provided OrientedBoundingBox component wise and returns */\n equals(right: OrientedBoundingBox): boolean {\n return (\n this === right ||\n (Boolean(right) && this.center.equals(right.center) && this.halfAxes.equals(right.halfAxes))\n );\n }\n\n /** Computes a tight-fitting bounding sphere enclosing the provided oriented bounding box. */\n getBoundingSphere(result = new BoundingSphere()): BoundingSphere {\n const halfAxes = this.halfAxes;\n const u = halfAxes.getColumn(0, scratchVectorU);\n const v = halfAxes.getColumn(1, scratchVectorV);\n const w = halfAxes.getColumn(2, scratchVectorW);\n\n // Calculate \"corner\" vector\n const cornerVector = scratchVector3.copy(u).add(v).add(w);\n\n result.center.copy(this.center);\n result.radius = cornerVector.magnitude();\n\n return result;\n }\n\n /** Determines which side of a plane the oriented bounding box is located. */\n intersectPlane(plane: Plane): number {\n const center = this.center;\n const normal = plane.normal;\n const halfAxes = this.halfAxes;\n\n const normalX = normal.x;\n const normalY = normal.y;\n const normalZ = normal.z;\n\n // Plane is used as if it is its normal; the first three components are assumed to be normalized\n const radEffective =\n Math.abs(\n normalX * halfAxes[MATRIX3.COLUMN0ROW0] +\n normalY * halfAxes[MATRIX3.COLUMN0ROW1] +\n normalZ * halfAxes[MATRIX3.COLUMN0ROW2]\n ) +\n Math.abs(\n normalX * halfAxes[MATRIX3.COLUMN1ROW0] +\n normalY * halfAxes[MATRIX3.COLUMN1ROW1] +\n normalZ * halfAxes[MATRIX3.COLUMN1ROW2]\n ) +\n Math.abs(\n normalX * halfAxes[MATRIX3.COLUMN2ROW0] +\n normalY * halfAxes[MATRIX3.COLUMN2ROW1] +\n normalZ * halfAxes[MATRIX3.COLUMN2ROW2]\n );\n const distanceToPlane = normal.dot(center) + plane.distance;\n\n if (distanceToPlane <= -radEffective) {\n // The entire box is on the negative side of the plane normal\n return INTERSECTION.OUTSIDE;\n } else if (distanceToPlane >= radEffective) {\n // The entire box is on the positive side of the plane normal\n return INTERSECTION.INSIDE;\n }\n return INTERSECTION.INTERSECTING;\n }\n\n /** Computes the estimated distance from the closest point on a bounding box to a point. */\n distanceTo(point: readonly number[]): number {\n return Math.sqrt(this.distanceSquaredTo(point));\n }\n\n /**\n * Computes the estimated distance squared from the closest point\n * on a bounding box to a point.\n * See Geometric Tools for Computer Graphics 10.4.2\n */\n distanceSquaredTo(point: readonly number[]): number {\n // Computes the estimated distance squared from the\n // closest point on a bounding box to a point.\n // See Geometric Tools for Computer Graphics 10.4.2\n const offset = scratchOffset.from(point).subtract(this.center);\n\n const halfAxes = this.halfAxes;\n const u = halfAxes.getColumn(0, scratchVectorU);\n const v = halfAxes.getColumn(1, scratchVectorV);\n const w = halfAxes.getColumn(2, scratchVectorW);\n\n const uHalf = u.magnitude();\n const vHalf = v.magnitude();\n const wHalf = w.magnitude();\n\n u.normalize();\n v.normalize();\n w.normalize();\n\n let distanceSquared = 0.0;\n let d;\n\n d = Math.abs(offset.dot(u)) - uHalf;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n d = Math.abs(offset.dot(v)) - vHalf;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n d = Math.abs(offset.dot(w)) - wHalf;\n if (d > 0) {\n distanceSquared += d * d;\n }\n\n return distanceSquared;\n }\n\n /**\n * The distances calculated by the vector from the center of the bounding box\n * to position projected onto direction.\n *\n * - If you imagine the infinite number of planes with normal direction,\n * this computes the smallest distance to the closest and farthest planes\n * from `position` that intersect the bounding box.\n *\n * @param position The position to calculate the distance from.\n * @param direction The direction from position.\n * @param result An Interval (array of length 2) to store the nearest and farthest distances.\n * @returns Interval (array of length 2) with nearest and farthest distances\n * on the bounding box from position in direction.\n */\n // eslint-disable-next-line max-statements\n computePlaneDistances(\n position: readonly number[],\n direction: Vector3,\n result: number[] = [-0, -0]\n ): number[] {\n let minDist = Number.POSITIVE_INFINITY;\n let maxDist = Number.NEGATIVE_INFINITY;\n\n const center = this.center;\n const halfAxes = this.halfAxes;\n\n const u = halfAxes.getColumn(0, scratchVectorU);\n const v = halfAxes.getColumn(1, scratchVectorV);\n const w = halfAxes.getColumn(2, scratchVectorW);\n\n // project first corner\n const corner = scratchCorner.copy(u).add(v).add(w).add(center);\n\n const toCenter = scratchToCenter.copy(corner).subtract(position);\n let mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project second corner\n corner.copy(center).add(u).add(v).subtract(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project third corner\n corner.copy(center).add(u).subtract(v).add(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project fourth corner\n corner.copy(center).add(u).subtract(v).subtract(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project fifth corner\n center.copy(corner).subtract(u).add(v).add(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project sixth corner\n center.copy(corner).subtract(u).add(v).subtract(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project seventh corner\n center.copy(corner).subtract(u).subtract(v).add(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n // project eighth corner\n center.copy(corner).subtract(u).subtract(v).subtract(w);\n\n toCenter.copy(corner).subtract(position);\n mag = direction.dot(toCenter);\n\n minDist = Math.min(mag, minDist);\n maxDist = Math.max(mag, maxDist);\n\n result[0] = minDist;\n result[1] = maxDist;\n return result;\n }\n\n /**\n * Applies a 4x4 affine transformation matrix to a bounding sphere.\n * @param transform The transformation matrix to apply to the bounding sphere.\n * @returns itself, i.e. the modified BoundingVolume.\n */\n transform(transformation: readonly number[]): this {\n this.center.transformAsPoint(transformation);\n\n const xAxis = this.halfAxes.getColumn(0, scratchVectorU);\n xAxis.transformAsPoint(transformation);\n\n const yAxis = this.halfAxes.getColumn(1, scratchVectorV);\n yAxis.transformAsPoint(transformation);\n\n const zAxis = this.halfAxes.getColumn(2, scratchVectorW);\n zAxis.transformAsPoint(transformation);\n\n this.halfAxes = new Matrix3([...xAxis, ...yAxis, ...zAxis]);\n return this;\n }\n\n getTransform(): Matrix4 {\n // const modelMatrix = Matrix4.fromRotationTranslation(this.boundingVolume.halfAxes, this.boundingVolume.center);\n // return modelMatrix;\n throw new Error('not implemented');\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Vector3, assert} from '@math.gl/core';\nimport {INTERSECTION} from '../constants';\nimport {Plane} from './plane';\nimport type {BoundingVolume} from './bounding-volumes/bounding-volume';\nimport type {BoundingSphere} from './bounding-volumes/bounding-sphere';\n\n// X, Y, Z Unit vectors\nconst faces = [new Vector3([1, 0, 0]), new Vector3([0, 1, 0]), new Vector3([0, 0, 1])];\n\nconst scratchPlaneCenter = new Vector3();\nconst scratchPlaneNormal = new Vector3();\n// const scratchPlane = new Plane(new Vector3(1.0, 0.0, 0.0), 0.0);\n\n/** A culling volume defined by planes. */\nexport class CullingVolume {\n /**\n * For plane masks (as used in {@link CullingVolume#computeVisibilityWithPlaneMask}), this special value\n * represents the case where the object bounding volume is entirely outside the culling volume.\n */\n static MASK_OUTSIDE = 0xffffffff;\n\n /**\n * For plane masks (as used in {@link CullingVolume.prototype.computeVisibilityWithPlaneMask}), this value\n * represents the case where the object bounding volume is entirely inside the culling volume.\n */\n static MASK_INSIDE = 0x00000000;\n\n /**\n * For plane masks (as used in {@link CullingVolume.prototype.computeVisibilityWithPlaneMask}), this value\n * represents the case where the object bounding volume (may) intersect all planes of the culling volume.\n */\n static MASK_INDETERMINATE = 0x7fffffff;\n\n /** Array of clipping planes. */\n readonly planes: Plane[];\n\n /**\n * Create a new `CullingVolume` bounded by an array of clipping planed\n * @param planes Array of clipping planes.\n * */\n constructor(planes: Plane[] = []) {\n this.planes = planes;\n }\n\n /**\n * Constructs a culling volume from a bounding sphere. Creates six planes that create a box containing the sphere.\n * The planes are aligned to the x, y, and z axes in world coordinates.\n */\n fromBoundingSphere(boundingSphere: BoundingSphere): CullingVolume {\n this.planes.length = 2 * faces.length;\n\n const center = boundingSphere.center;\n const radius = boundingSphere.radius;\n\n let planeIndex = 0;\n\n for (const faceNormal of faces) {\n let plane0 = this.planes[planeIndex];\n let plane1 = this.planes[planeIndex + 1];\n\n if (!plane0) {\n plane0 = this.planes[planeIndex] = new Plane();\n }\n if (!plane1) {\n plane1 = this.planes[planeIndex + 1] = new Plane();\n }\n\n const plane0Center = scratchPlaneCenter.copy(faceNormal).scale(-radius).add(center);\n // const plane0Distance = -faceNormal.dot(plane0Center);\n\n plane0.fromPointNormal(plane0Center, faceNormal);\n\n const plane1Center = scratchPlaneCenter.copy(faceNormal).scale(radius).add(center);\n\n const negatedFaceNormal = scratchPlaneNormal.copy(faceNormal).negate();\n\n // const plane1Distance = -negatedFaceNormal.dot(plane1Center);\n\n plane1.fromPointNormal(plane1Center, negatedFaceNormal);\n\n planeIndex += 2;\n }\n\n return this;\n }\n\n /** Determines whether a bounding volume intersects the culling volume. */\n computeVisibility(boundingVolume: BoundingVolume): number {\n // const planes = this.planes;\n let intersect: number = INTERSECTION.INSIDE;\n for (const plane of this.planes) {\n const result = boundingVolume.intersectPlane(plane);\n switch (result) {\n case INTERSECTION.OUTSIDE:\n // We are done\n return INTERSECTION.OUTSIDE;\n\n case INTERSECTION.INTERSECTING:\n // If no other intersection is outside, return INTERSECTING\n intersect = INTERSECTION.INTERSECTING;\n break;\n\n default:\n }\n }\n\n return intersect;\n }\n\n /**\n * Determines whether a bounding volume intersects the culling volume.\n *\n * @param parentPlaneMask A bit mask from the boundingVolume's parent's check against the same culling\n * volume, such that if (planeMask & (1 << planeIndex) === 0), for k < 31, then\n * the parent (and therefore this) volume is completely inside plane[planeIndex]\n * and that plane check can be skipped.\n */\n computeVisibilityWithPlaneMask(boundingVolume: BoundingVolume, parentPlaneMask: number): number {\n assert(Number.isFinite(parentPlaneMask), 'parentPlaneMask is required.');\n\n if (\n parentPlaneMask === CullingVolume.MASK_OUTSIDE ||\n parentPlaneMask === CullingVolume.MASK_INSIDE\n ) {\n // parent is completely outside or completely inside, so this child is as well.\n return parentPlaneMask;\n }\n\n // Start with MASK_INSIDE (all zeros) so that after the loop, the return value can be compared with MASK_INSIDE.\n // (Because if there are fewer than 31 planes, the upper bits wont be changed.)\n let mask = CullingVolume.MASK_INSIDE;\n\n const planes = this.planes;\n for (let k = 0; k < this.planes.length; ++k) {\n // For k greater than 31 (since 31 is the maximum number of INSIDE/INTERSECTING bits we can store), skip the optimization.\n const flag = k < 31 ? 1 << k : 0;\n if (k < 31 && (parentPlaneMask & flag) === 0) {\n // boundingVolume is known to be INSIDE this plane.\n continue;\n }\n\n const plane = planes[k];\n const result = boundingVolume.intersectPlane(plane);\n if (result === INTERSECTION.OUTSIDE) {\n return CullingVolume.MASK_OUTSIDE;\n } else if (result === INTERSECTION.INTERSECTING) {\n mask |= flag;\n }\n }\n\n return mask;\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n/* eslint-disable */\nimport {Vector3, equals, assert, NumericArray, _MathUtils} from '@math.gl/core';\nimport {Ray} from './ray';\n\nconst scratchPosition = new Vector3();\nconst scratchNormal = new Vector3();\n\n// A plane in Hessian Normal Form\nexport class Plane {\n readonly normal: Vector3;\n distance: number;\n\n constructor(normal: Readonly<NumericArray> = [0, 0, 1], distance: number = 0) {\n this.normal = new Vector3();\n this.distance = -0;\n this.fromNormalDistance(normal, distance);\n }\n\n /** Creates a plane from a normal and a distance from the origin. */\n fromNormalDistance(normal: Readonly<NumericArray>, distance: number): this {\n assert(Number.isFinite(distance));\n this.normal.from(normal).normalize();\n this.distance = distance;\n return this;\n }\n\n /** Creates a plane from a normal and a point on the plane. */\n fromPointNormal(point: Readonly<NumericArray>, normal: Readonly<NumericArray>): this {\n point = scratchPosition.from(point);\n this.normal.from(normal).normalize();\n const distance = -this.normal.dot(point);\n this.distance = distance;\n return this;\n }\n\n /** Creates a plane from the general equation */\n fromCoefficients(a: number, b: number, c: number, d: number): this {\n this.normal.set(a, b, c);\n assert(equals(this.normal.len(), 1));\n this.distance = d;\n return this;\n }\n\n /** Duplicates a Plane instance. */\n clone(): Plane {\n return new Plane(this.normal, this.distance);\n }\n\n /** Compares the provided Planes by normal and distance */\n equals(right: Plane): boolean {\n return equals(this.distance, right.distance) && equals(this.normal, right.normal);\n }\n\n /** Computes the signed shortest distance of a point to a plane.\n * The sign of the distance determines which side of the plane the point is on.\n */\n getPointDistance(point: Readonly<NumericArray>): number {\n return this.normal.dot(point) + this.distance;\n }\n\n /** Transforms the plane by the given transformation matrix. */\n transform(matrix4: Readonly<NumericArray>): this {\n const normal = scratchNormal.copy(this.normal).transformAsVector(matrix4).normalize();\n const point = this.normal.scale(-this.distance).transform(matrix4);\n return this.fromPointNormal(point, normal);\n }\n\n /** Projects a point onto the plane. */\n projectPointOntoPlane(point: Readonly<NumericArray>, result: Vector3): Vector3;\n projectPointOntoPlane(\n point: Readonly<NumericArray>,\n result?: readonly number[]\n ): readonly number[];\n\n projectPointOntoPlane(point: Readonly<NumericArray>, result = [0, 0, 0]) {\n const scratchPoint = scratchPosition.from(point);\n // projectedPoint = point - (normal.point + scale) * normal\n const pointDistance = this.getPointDistance(scratchPoint);\n const scaledNormal = scratchNormal.copy(this.normal).scale(pointDistance);\n\n return scratchPoint.subtract(scaledNormal).to(result);\n }\n\n /**\n * Computes the intersection of a ray and this plane.\n *\n * @param {Ray} ray The ray.\n * @param {Vector3} [result] The object onto which to store the result.\n * @returns {Vector3} The intersection point or undefined if there is no intersections.\n */\n intersectWithRay(ray: Ray, result?: Vector3): Vector3 {\n if (!result) result = new Vector3();\n\n const origin = ray.origin;\n const direction = ray.direction;\n const normal = this.normal;\n const denominator = normal.dot(direction);\n\n if (Math.abs(denominator) < _MathUtils.EPSILON15) {\n return undefined;\n }\n\n const t = (-this.distance - normal.dot(origin)) / denominator;\n\n if (t < 0) {\n return undefined;\n }\n\n result = result.copy(direction).multiplyByScalar(t);\n return origin.add(result);\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector3} from '@math.gl/core';\n\n/* Represents a ray that extends infinitely from the provided origin in the provided direction. */\nexport class Ray {\n origin: Vector3;\n direction: Vector3;\n\n /**\n * Creates a new ray that extends infinitely from the provided origin in the provided direction.\n *\n * @param [origin=Vector3] The origin of the ray.\n * @param [direction=Vector3] The direction of the ray.\n */\n constructor(origin?: Vector3, direction?: Vector3) {\n if (origin) origin = origin.clone();\n else origin = new Vector3();\n\n if (direction) direction = direction.clone().normalize();\n else direction = new Vector3();\n\n this.origin = origin;\n this.direction = direction;\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// Note: This class is still an experimental export, mainly used by other test cases\n// - It has not been fully adapted to math.gl conventions\n// - Documentation has not been ported\n\nimport {Vector3, Vector2, Matrix4, assert, NumericArray} from '@math.gl/core';\nimport {CullingVolume} from './culling-volume';\nimport {Plane} from './plane';\n\nconst scratchPlaneUpVector = new Vector3();\nconst scratchPlaneRightVector = new Vector3();\nconst scratchPlaneNearCenter = new Vector3();\nconst scratchPlaneFarCenter = new Vector3();\nconst scratchPlaneNormal = new Vector3();\n\ntype PerspectiveOffCenterFrustumOptions = {\n left?: number;\n right?: number;\n top?: number;\n bottom?: number;\n near?: number;\n far?: number;\n};\n\nexport class PerspectiveOffCenterFrustum {\n /**\n * Defines the left clipping plane.\n * @type {Number}\n * @default undefined\n */\n left?: number;\n private _left?: number;\n /**\n * Defines the right clipping plane.\n * @type {Number}\n * @default undefined\n */\n right?: number;\n private _right?: number;\n /**\n * Defines the top clipping plane.\n * @type {Number}\n * @default undefined\n */\n top?: number;\n private _top?: number;\n /**\n * Defines the bottom clipping plane.\n * @type {Number}\n * @default undefined\n */\n bottom?: number;\n private _bottom?: number;\n /**\n * The distance of the near plane.\n * @type {Number}\n * @default 1.0\n */\n near: number;\n private _near: number;\n /**\n * The distance of the far plane.\n * @type {Number}\n * @default 500000000.0\n */\n far: number;\n private _far: number;\n\n private _cullingVolume = new CullingVolume([\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane(),\n new Plane()\n ]);\n private _perspectiveMatrix = new Matrix4();\n private _infinitePerspective = new Matrix4();\n\n /**\n * The viewing frustum is defined by 6 planes.\n * Each plane is represented by a {@link Vector4} object, where the x, y, and z components\n * define the unit vector normal to the plane, and the w component is the distance of the\n * plane from the origin/camera position.\n *\n * @alias PerspectiveOffCenterFrustum\n *\n * @example\n * const frustum = new PerspectiveOffCenterFrustum({\n * left : -1.0,\n * right : 1.0,\n * top : 1.0,\n * bottom : -1.0,\n * near : 1.0,\n * far : 100.0\n * });\n *\n * @see PerspectiveFrustum\n */\n constructor(options: PerspectiveOffCenterFrustumOptions = {}) {\n const {near = 1.0, far = 500000000.0} = options;\n\n this.left = options.left;\n this._left = undefined;\n\n this.right = options.right;\n this._right = undefined;\n\n this.top = options.top;\n this._top = undefined;\n\n this.bottom = options.bottom;\n this._bottom = undefined;\n\n this.near = near;\n this._near = near;\n\n this.far = far;\n this._far = far;\n }\n\n /**\n * Returns a duplicate of a PerspectiveOffCenterFrustum instance.\n * @returns {PerspectiveOffCenterFrustum} A new PerspectiveFrustum instance.\n * */\n clone(): PerspectiveOffCenterFrustum {\n return new PerspectiveOffCenterFrustum({\n right: this.right,\n left: this.left,\n top: this.top,\n bottom: this.bottom,\n near: this.near,\n far: this.far\n });\n }\n\n /**\n * Compares the provided PerspectiveOffCenterFrustum componentwise and returns\n * <code>true</code> if they are equal, <code>false</code> otherwise.\n *\n * @returns {Boolean} <code>true</code> if they are equal, <code>false</code> otherwise.\n */\n equals(other: PerspectiveOffCenterFrustum): boolean {\n return (\n other &&\n other instanceof PerspectiveOffCenterFrustum &&\n this.right === other.right &&\n this.left === other.left &&\n this.top === other.top &&\n this.bottom === other.bottom &&\n this.near === other.near &&\n this.far === other.far\n );\n }\n\n /**\n * Gets the perspective projection matrix computed from the view frustum.\n * @memberof PerspectiveOffCenterFrustum.prototype\n * @type {Matrix4}\n *\n * @see PerspectiveOffCenterFrustum#infiniteProjectionMatrix\n */\n get projectionMatrix(): Matrix4 {\n this._update();\n return this._perspectiveMatrix;\n }\n\n /**\n * Gets the perspective projection matrix computed from the view frustum with an infinite far plane.\n * @memberof PerspectiveOffCenterFrustum.prototype\n * @type {Matrix4}\n *\n * @see PerspectiveOffCenterFrustum#projectionMatrix\n */\n get infiniteProjectionMatrix(): Matrix4 {\n this._update();\n return this._infinitePerspective;\n }\n\n /**\n * Creates a culling volume for this frustum.\n * @returns {CullingVolume} A culling volume at the given position and orientation.\n *\n * @example\n * // Check if a bounding volume intersects the frustum.\n * const cullingVolume = frustum.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);\n * const intersect = cullingVolume.computeVisibility(boundingVolume);\n */\n // eslint-disable-next-line complexity, max-statements\n computeCullingVolume(\n /** A Vector3 defines the eye position. */\n position: Readonly<NumericArray>,\n /** A Vector3 defines the view direction. */\n direction: Readonly<NumericArray>,\n /** A Vector3 defines the up direction. */\n up: Readonly<NumericArray>\n ): CullingVolume {\n assert(position, 'position is required.');\n assert(direction, 'direction is required.');\n assert(up, 'up is required.');\n\n const planes = this._cullingVolume.planes;\n\n up = scratchPlaneUpVector.copy(up).normalize();\n const right = scratchPlaneRightVector.copy(direction).cross(up).normalize();\n\n const nearCenter = scratchPlaneNearCenter\n .copy(direction)\n .multiplyByScalar(this.near)\n .add(position);\n\n const farCenter = scratchPlaneFarCenter\n .copy(direction)\n .multiplyByScalar(this.far)\n .add(position);\n\n let normal = scratchPlaneNormal;\n\n // Left plane computation\n normal.copy(right).multiplyByScalar(this.left).add(nearCenter).subtract(position).cross(up);\n\n planes[0].fromPointNormal(position, normal);\n\n // Right plane computation\n normal\n .copy(right)\n .multiplyByScalar(this.right)\n .add(nearCenter)\n .subtract(position)\n .cross(up)\n .negate();\n\n planes[1].fromPointNormal(position, normal);\n\n // Bottom plane computation\n normal\n .copy(up)\n .multiplyByScalar(this.bottom)\n .add(nearCenter)\n .subtract(position)\n .cross(right)\n .negate();\n\n planes[2].fromPointNormal(position, normal);\n\n // Top plane computation\n normal.copy(up).multiplyByScalar(this.top).add(nearCenter).subtract(position).cross(right);\n\n planes[3].fromPointNormal(position, normal);\n\n normal = new Vector3().copy(direction);\n\n // Near plane computation\n planes[4].fromPointNormal(nearCenter, normal);\n\n // Far plane computation\n normal.negate();\n\n planes[5].fromPointNormal(farCenter, normal);\n\n return this._cullingVolume;\n }\n\n /**\n * Returns the pixel's width and height in meters.\n *\n * @returns {Vector2} The modified result parameter or a new instance of {@link Vector2} with the pixel's width and height in the x and y properties, respectively.\n *\n * @exception {DeveloperError} drawingBufferWidth must be greater than zero.\n * @exception {DeveloperError} drawingBufferHeight must be greater than zero.\n *\n * @example\n * // Example 1\n * // Get the width and height of a pixel.\n * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, new Vector2());\n *\n * @example\n * // Example 2\n * // Get the width and height of a pixel if the near plane was set to 'distance'.\n * // For example, get the size of a pixel of an image on a billboard.\n * const position = camera.position;\n * const direction = camera.direction;\n * const toCenter = Vector3.subtract(primitive.boundingVolume.center, position, new Vector3()); // vector from camera to a primitive\n * const toCenterProj = Vector3.multiplyByScalar(direction, Vector3.dot(direction, toCenter), new Vector3()); // project vector onto camera direction vector\n * const distance = Vector3.magnitude(toCenterProj);\n * const pixelSize = camera.frustum.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, new Vector2());\n */\n getPixelDimensions(\n /** The width of the drawing buffer. */\n drawingBufferWidth: number,\n /** The height of the drawing buffer. */\n drawingBufferHeight: number,\n /** The distance to the near plane in meters. */\n distance: number,\n /** The object onto which to store the result. */\n result: Vector2\n ): Vector2 {\n this._update();\n\n assert(Number.isFinite(drawingBufferWidth) && Number.isFinite(drawingBufferHeight));\n // 'Both drawingBufferWidth and drawingBufferHeight are required.'\n assert(drawingBufferWidth > 0);\n // 'drawingBufferWidth must be greater than zero.'\n assert(drawingBufferHeight > 0);\n // 'drawingBufferHeight must be greater than zero.'\n assert(distance > 0);\n // 'distance is required.');\n assert(result);\n // 'A result object is required.');\n\n const inverseNear = 1.0 / this.near;\n let tanTheta = this.top * inverseNear;\n const pixelHeight = (2.0 * distance * tanTheta) / drawingBufferHeight;\n tanTheta = this.right * inverseNear;\n const pixelWidth = (2.0 * distance * tanTheta) / drawingBufferWidth;\n\n result.x = pixelWidth;\n result.y = pixelHeight;\n return result;\n }\n\n // eslint-disable-next-line complexity, max-statements\n private _update() {\n assert(\n Number.isFinite(this.right) &&\n Number.isFinite(this.left) &&\n Number.isFinite(this.top) &&\n Number.isFinite(this.bottom) &&\n Number.isFinite(this.near) &&\n Number.isFinite(this.far)\n );\n // throw new DeveloperError('right, left, top, bottom, near, or far parameters are not set.');\n\n const {top, bottom, right, left, near, far} = this;\n\n if (\n top !== this._top ||\n bottom !== this._bottom ||\n left !== this._left ||\n right !== this._right ||\n near !== this._near ||\n far !== this._far\n ) {\n assert(\n this.near > 0 && this.near < this.far,\n 'near must be greater than zero and less than far.'\n );\n\n this._left = left;\n this._right = right;\n this._top = top;\n this._bottom = bottom;\n this._near = near;\n this._far = far;\n this._perspectiveMatrix = new Matrix4().frustum({\n left,\n right,\n bottom,\n top,\n near,\n far\n });\n this._infinitePerspective = new Matrix4().frustum({\n left,\n right,\n bottom,\n top,\n near,\n far: Infinity\n });\n }\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// Note: This class is still an experimental export, mainly used by other test cases\n// - It has not been fully adapted to math.gl conventions\n// - Documentation has not been ported\n\nimport {NumericArray} from '@math.gl/types';\nimport {assert, Matrix4, Vector2} from '@math.gl/core';\nimport {PerspectiveOffCenterFrustum} from './perspective-off-center-frustum';\nimport {CullingVolume} from './culling-volume';\n\nconst defined = (val: unknown) => val !== null && typeof val !== 'undefined';\n\ntype PerspectiveFrustumOptions = {\n /** The angle of the field of view (FOV), in radians. */\n fov?: number;\n /** The aspect ratio of the frustum's width to it's height. */\n aspectRatio?: number;\n /** The distance of the near plane. */\n near?: number;\n /** The distance of the far plane. */\n far?: number;\n /** The offset in the x direction. */\n xOffset?: number;\n /** The offset in the y direction. */\n yOffset?: number;\n};\n\n/**\n * The viewing frustum is defined by 6 planes.\n * Each plane is represented by a {@link Vector4} object, where the x, y, and z components\n * define the unit vector normal to the plane, and the w component is the distance of the\n * plane from the origin/camera position.\n *\n * @alias PerspectiveFrustum\n *\n * @example\n * var frustum = new PerspectiveFrustum({\n * fov : Math.PI_OVER_THREE,\n * aspectRatio : canvas.clientWidth / canvas.clientHeight\n * near : 1.0,\n * far : 1000.0\n * });\n *\n * @see PerspectiveOffCenterFrustum\n */\nexport class PerspectiveFrustum {\n private _offCenterFrustum = new PerspectiveOffCenterFrustum();\n /**\n * The angle of the field of view (FOV), in radians. This angle will be used\n * as the horizontal FOV if the width is greater than the height, otherwise\n * it will be the vertical FOV.\n */\n fov?: number;\n private _fov: number;\n private _fovy: number;\n private _sseDenominator: number;\n /**\n * The aspect ratio of the frustum's width to it's height.\n */\n aspectRatio?: number;\n private _aspectRatio: number;\n /**\n * The distance of the near plane.\n * @default 1.0\n */\n near: number;\n private _near: number;\n /**\n * The distance of the far plane.\n * @default 500000000.0\n */\n far: number;\n private _far: number;\n /**\n * Offsets the frustum in the x direction.\n * @default 0.0\n */\n xOffset: number;\n private _xOffset: number;\n /**\n * Offsets the frustum in the y direction.\n * @default 0.0\n */\n yOffset: number;\n private _yOffset: number;\n\n constructor(options: PerspectiveFrustumOptions = {}) {\n const {fov, aspectRatio, near = 1.0, far = 500000000.0, xOffset = 0.0, yOffset = 0.0} = options;\n\n this.fov = fov;\n this.aspectRatio = aspectRatio;\n this.near = near;\n this.far = far;\n this.xOffset = xOffset;\n this.yOffset = yOffset;\n }\n\n /**\n * Returns a duplicate of a PerspectiveFrustum instance.\n */\n clone(): PerspectiveFrustum {\n return new PerspectiveFrustum({\n aspectRatio: this.aspectRatio,\n fov: this.fov,\n near: this.near,\n far: this.far\n });\n }\n\n /**\n * Compares the provided PerspectiveFrustum componentwise and returns\n * <code>true</code> if they are equal, <code>false</code> otherwise.\n */\n equals(other: PerspectiveFrustum): boolean {\n if (!defined(other) || !(other instanceof PerspectiveFrustum)) {\n return false;\n }\n\n this._update();\n other._update();\n\n return (\n this.fov === other.fov &&\n this.aspectRatio === other.aspectRatio &&\n this.near === other.near &&\n this.far === other.far &&\n this._offCenterFrustum.equals(other._offCenterFrustum)\n );\n }\n\n /**\n * Gets the perspective projection matrix computed from the view this.\n */\n get projectionMatrix(): Matrix4 {\n this._update();\n return this._offCenterFrustum.projectionMatrix;\n }\n\n /**\n * The perspective projection matrix computed from the view frustum with an infinite far plane.\n */\n get infiniteProjectionMatrix(): Matrix4 {\n this._update();\n return this._offCenterFrustum.infiniteProjectionMatrix;\n }\n\n /**\n * Gets the angle of the vertical field of view, in radians.\n */\n get fovy(): number {\n this._update();\n return this._fovy;\n }\n\n /**\n * @private\n */\n get sseDenominator(): number {\n this._update();\n return this._sseDenominator;\n }\n\n /**\n * Creates a culling volume for this this.ion.\n * @returns {CullingVolume} A culling volume at the given position and orientation.\n *\n * @example\n * // Check if a bounding volume intersects the this.\n * var cullingVolume = this.computeCullingVolume(cameraPosition, cameraDirection, cameraUp);\n * var intersect = cullingVolume.computeVisibility(boundingVolume);\n */\n computeCullingVolume(\n /** A Vector3 defines the eye position. */\n position: Readonly<NumericArray>,\n /** A Vector3 defines the view direction. */\n direction: Readonly<NumericArray>,\n /** A Vector3 defines the up direction. */\n up: Readonly<NumericArray>\n ): CullingVolume {\n this._update();\n return this._offCenterFrustum.computeCullingVolume(position, direction, up);\n }\n\n /**\n * Returns the pixel's width and height in meters.\n * @returns {Vector2} The modified result parameter or a new instance of {@link Vector2} with the pixel's width and height in the x and y properties, respectively.\n *\n * @exception {DeveloperError} drawingBufferWidth must be greater than zero.\n * @exception {DeveloperError} drawingBufferHeight must be greater than zero.\n *\n * @example\n * // Example 1\n * // Get the width and height of a pixel.\n * var pixelSize = camera.this.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, 1.0, new Vector2());\n *\n * @example\n * // Example 2\n * // Get the width and height of a pixel if the near plane was set to 'distance'.\n * // For example, get the size of a pixel of an image on a billboard.\n * var position = camera.position;\n * var direction = camera.direction;\n * var toCenter = Vector3.subtract(primitive.boundingVolume.center, position, new Vector3()); // vector from camera to a primitive\n * var toCenterProj = Vector3.multiplyByScalar(direction, Vector3.dot(direction, toCenter), new Vector3()); // project vector onto camera direction vector\n * var distance = Vector3.magnitude(toCenterProj);\n * var pixelSize = camera.this.getPixelDimensions(scene.drawingBufferWidth, scene.drawingBufferHeight, distance, new Vector2());\n */\n getPixelDimensions(\n /** The width of the drawing buffer. */\n drawingBufferWidth: number,\n /** The height of the drawing buffer. */\n drawingBufferHeight: number,\n /** The distance to the near plane in meters. */\n distance: number,\n /** The object onto which to store the result. */\n result?: Vector2\n ): Vector2 {\n this._update();\n return this._offCenterFrustum.getPixelDimensions(\n drawingBufferWidth,\n drawingBufferHeight,\n distance,\n result || new Vector2()\n );\n }\n\n // eslint-disable-next-line complexity, max-statements\n private _update(): void {\n assert(\n Number.isFinite(this.fov) &&\n Number.isFinite(this.aspectRatio) &&\n Number.isFinite(this.near) &&\n Number.isFinite(this.far)\n );\n // 'fov, aspectRatio, near, or far parameters are not set.'\n\n const f = this._offCenterFrustum;\n\n if (\n this.fov !== this._fov ||\n this.aspectRatio !== this._aspectRatio ||\n this.near !== this._near ||\n this.far !== this._far ||\n this.xOffset !== this._xOffset ||\n this.yOffset !== this._yOffset\n ) {\n assert(this.fov >= 0 && this.fov < Math.PI);\n // throw new DeveloperError('fov must be in the range [0, PI).');\n\n assert(this.aspectRatio > 0);\n // throw new DeveloperError('aspectRatio must be positive.');\n\n assert(this.near >= 0 && this.near < this.far);\n // throw new DeveloperError('near must be greater than zero and less than far.');\n\n this._aspectRatio = this.aspectRatio;\n this._fov = this.fov;\n this._fovy =\n this.aspectRatio <= 1\n ? this.fov\n : Math.atan(Math.tan(this.fov * 0.5) / this.aspectRatio) * 2.0;\n this._near = this.near;\n this._far = this.far;\n this._sseDenominator = 2.0 * Math.tan(0.5 * this._fovy);\n this._xOffset = this.xOffset;\n this._yOffset = this.yOffset;\n\n f.top = this.near * Math.tan(0.5 * this._fovy);\n f.bottom = -f.top;\n f.right = this.aspectRatio * f.top;\n f.left = -f.right;\n f.near = this.near;\n f.far = this.far;\n\n f.right += this.xOffset;\n f.left += this.xOffset;\n f.top += this.yOffset;\n f.bottom += this.yOffset;\n }\n }\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector3} from '@math.gl/core';\nimport {BoundingSphere} from '../bounding-volumes/bounding-sphere';\n\n/* eslint-disable */\nconst fromPointsXMin = new Vector3();\nconst fromPointsYMin = new Vector3();\nconst fromPointsZMin = new Vector3();\nconst fromPointsXMax = new Vector3();\nconst fromPointsYMax = new Vector3();\nconst fromPointsZMax = new Vector3();\nconst fromPointsCurrentPos = new Vector3();\nconst fromPointsScratch = new Vector3();\nconst fromPointsRitterCenter = new Vector3();\nconst fromPointsMinBoxPt = new Vector3();\nconst fromPointsMaxBoxPt = new Vector3();\nconst fromPointsNaiveCenterScratch = new Vector3();\n// const volumeConstant = (4.0 / 3.0) * Math.PI;\n\n/**\n * Computes a tight-fitting bounding sphere enclosing a list of 3D Cartesian points.\n *\n * The bounding sphere is computed by running two algorithms, a naive algorithm and\n * Ritter's algorithm. The smaller of the two spheres is used to ensure a tight fit.\n * Bounding sphere computation article http://blogs.agi.com/insight3d/index.php/2008/02/04/a-bounding\n *\n * @param positions An array of points that the bounding sphere will enclose.\n * @param result Optional object onto which to store the result.\n * @returns The modified result parameter or a new `BoundingSphere` instance if not provided.\n */\nexport function makeBoundingSphereFromPoints(\n positions: number[][],\n result: BoundingSphere = new BoundingSphere()\n): BoundingSphere {\n if (!positions || positions.length === 0) {\n return result.fromCenterRadius([0, 0, 0], 0);\n }\n\n const currentPos = fromPointsCurrentPos.copy(positions[0]);\n\n const xMin = fromPointsXMin.copy(currentPos);\n const yMin = fromPointsYMin.copy(currentPos);\n const zMin = fromPointsZMin.copy(currentPos);\n\n const xMax = fromPointsXMax.copy(currentPos);\n const yMax = fromPointsYMax.copy(currentPos);\n const zMax = fromPointsZMax.copy(currentPos);\n\n for (const position of positions) {\n currentPos.copy(position);\n\n const x = currentPos.x;\n const y = currentPos.y;\n const z = currentPos.z;\n\n // Store points containing the the smallest and largest components\n if (x < xMin.x) {\n xMin.copy(currentPos);\n }\n\n if (x > xMax.x) {\n xMax.copy(currentPos);\n }\n\n if (y < yMin.y) {\n yMin.copy(currentPos);\n }\n\n if (y > yMax.y) {\n yMax.copy(currentPos);\n }\n\n if (z < zMin.z) {\n zMin.copy(currentPos);\n }\n\n if (z > zMax.z) {\n zMax.copy(currentPos);\n }\n }\n\n // Compute x-, y-, and z-spans (Squared distances b/n each component's min. and max.).\n const xSpan = fromPointsScratch.copy(xMax).subtract(xMin).magnitudeSquared();\n const ySpan = fromPointsScratch.copy(yMax).subtract(yMin).magnitudeSquared();\n const zSpan = fromPointsScratch.copy(zMax).subtract(zMin).magnitudeSquared();\n\n // Set the diameter endpoints to the largest span.\n let diameter1 = xMin;\n let diameter2 = xMax;\n let maxSpan = xSpan;\n if (ySpan > maxSpan) {\n maxSpan = ySpan;\n diameter1 = yMin;\n diameter2 = yMax;\n }\n if (zSpan > maxSpan) {\n maxSpan = zSpan;\n diameter1 = zMin;\n diameter2 = zMax;\n }\n\n // Calculate the center of the initial sphere found by Ritter's algorithm\n const ritterCenter = fromPointsRitterCenter;\n ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;\n ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;\n ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;\n\n // Calculate the radius of the initial sphere found by Ritter's algorithm\n let radiusSquared = fromPointsScratch.copy(diameter2).subtract(ritterCenter).magnitudeSquared();\n let ritterRadius = Math.sqrt(radiusSquared);\n\n // Find the center of the sphere found using the Naive method.\n const minBoxPt = fromPointsMinBoxPt;\n minBoxPt.x = xMin.x;\n minBoxPt.y = yMin.y;\n minBoxPt.z = zMin.z;\n\n const maxBoxPt = fromPointsMaxBoxPt;\n maxBoxPt.x = xMax.x;\n maxBoxPt.y = yMax.y;\n maxBoxPt.z = zMax.z;\n\n const naiveCenter = fromPointsNaiveCenterScratch\n .copy(minBoxPt)\n .add(maxBoxPt)\n .multiplyByScalar(0.5);\n\n // Begin 2nd pass to find naive radius and modify the ritter sphere.\n let naiveRadius = 0;\n for (const position of positions) {\n currentPos.copy(position);\n\n // Find the furthest point from the naive center to calculate the naive radius.\n const r = fromPointsScratch.copy(currentPos).subtract(naiveCenter).magnitude();\n if (r > naiveRadius) {\n naiveRadius = r;\n }\n\n // Make adjustments to the Ritter Sphere to include all points.\n const oldCenterToPointSquared = fromPointsScratch\n .copy(currentPos)\n .subtract(ritterCenter)\n .magnitudeSquared();\n\n if (oldCenterToPointSquared > radiusSquared) {\n const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);\n // Calculate new radius to include the point that lies outside\n ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;\n radiusSquared = ritterRadius * ritterRadius;\n // Calculate center of new Ritter sphere\n const oldToNew = oldCenterToPoint - ritterRadius;\n ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;\n ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;\n ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;\n }\n }\n\n if (ritterRadius < naiveRadius) {\n ritterCenter.to(result.center);\n result.radius = ritterRadius;\n } else {\n naiveCenter.to(result.center);\n result.radius = naiveRadius;\n }\n\n return result;\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Vector3, Matrix3} from '@math.gl/core';\nimport {computeEigenDecomposition} from './compute-eigen-decomposition';\nimport {OrientedBoundingBox} from '../bounding-volumes/oriented-bounding-box';\nimport {AxisAlignedBoundingBox} from '../bounding-volumes/axis-aligned-bounding-box';\n\nconst scratchVector2 = new Vector3();\n\nconst scratchVector3 = new Vector3();\n\nconst scratchVector4 = new Vector3();\n\nconst scratchVector5 = new Vector3();\n\nconst scratchVector6 = new Vector3();\n\nconst scratchCovarianceResult = new Matrix3();\n\nconst scratchEigenResult = {\n diagonal: new Matrix3(),\n unitary: new Matrix3()\n};\n\n/**\n * Computes an instance of an OrientedBoundingBox of the given positions.\n *\n * This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis).\n * Reference: http://gamma.cs.unc.edu/users/gottschalk/main.pdf\n */\n/* eslint-disable max-statements */\nexport function makeOrientedBoundingBoxFromPoints(\n positions: number[][],\n result: OrientedBoundingBox = new OrientedBoundingBox()\n): OrientedBoundingBox {\n if (!positions || positions.length === 0) {\n result.halfAxes = new Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);\n result.center = new Vector3();\n return result;\n }\n\n const length = positions.length;\n const meanPoint = new Vector3(0, 0, 0);\n for (const position of positions) {\n meanPoint.add(position);\n }\n const invLength = 1.0 / length;\n meanPoint.multiplyByScalar(invLength);\n\n let exx = 0.0;\n let exy = 0.0;\n let exz = 0.0;\n let eyy = 0.0;\n let eyz = 0.0;\n let ezz = 0.0;\n\n for (const position of positions) {\n const p = scratchVector2.copy(position).subtract(meanPoint);\n exx += p.x * p.x;\n exy += p.x * p.y;\n exz += p.x * p.z;\n eyy += p.y * p.y;\n eyz += p.y * p.z;\n ezz += p.z * p.z;\n }\n\n exx *= invLength;\n exy *= invLength;\n exz *= invLength;\n eyy *= invLength;\n eyz *= invLength;\n ezz *= invLength;\n\n const covarianceMatrix = scratchCovarianceResult;\n covarianceMatrix[0] = exx;\n covarianceMatrix[1] = exy;\n covarianceMatrix[2] = exz;\n covarianceMatrix[3] = exy;\n covarianceMatrix[4] = eyy;\n covarianceMatrix[5] = eyz;\n covarianceMatrix[6] = exz;\n covarianceMatrix[7] = eyz;\n covarianceMatrix[8] = ezz;\n\n const {unitary} = computeEigenDecomposition(covarianceMatrix, scratchEigenResult);\n const rotation = result.halfAxes.copy(unitary);\n\n let v1 = rotation.getColumn(0, scratchVector4);\n let v2 = rotation.getColumn(1, scratchVector5);\n let v3 = rotation.getColumn(2, scratchVector6);\n\n let u1 = -Number.MAX_VALUE;\n let u2 = -Number.MAX_VALUE;\n let u3 = -Number.MAX_VALUE;\n let l1 = Number.MAX_VALUE;\n let l2 = Number.MAX_VALUE;\n let l3 = Number.MAX_VALUE;\n\n for (const position of positions) {\n scratchVector2.copy(position);\n\n u1 = Math.max(scratchVector2.dot(v1), u1);\n u2 = Math.max(scratchVector2.dot(v2), u2);\n u3 = Math.max(scratchVector2.dot(v3), u3);\n\n l1 = Math.min(scratchVector2.dot(v1), l1);\n l2 = Math.min(scratchVector2.dot(v2), l2);\n l3 = Math.min(scratchVector2.dot(v3), l3);\n }\n\n v1 = v1.multiplyByScalar(0.5 * (l1 + u1));\n v2 = v2.multiplyByScalar(0.5 * (l2 + u2));\n v3 = v3.multiplyByScalar(0.5 * (l3 + u3));\n\n result.center.copy(v1).add(v2).add(v3);\n\n const scale = scratchVector3.set(u1 - l1, u2 - l2, u3 - l3).multiplyByScalar(0.5);\n const scaleMatrix = new Matrix3([scale[0], 0, 0, 0, scale[1], 0, 0, 0, scale[2]]);\n result.halfAxes.multiplyRight(scaleMatrix);\n\n return result;\n}\n\n/**\n * Computes an instance of an AxisAlignedBoundingBox. The box is determined by\n * finding the points spaced the farthest apart on the x, y, and z axes.\n */\nexport function makeAxisAlignedBoundingBoxFromPoints(\n positions: readonly number[][],\n result: AxisAlignedBoundingBox = new AxisAlignedBoundingBox()\n): AxisAlignedBoundingBox {\n if (!positions || positions.length === 0) {\n result.minimum.set(0, 0, 0);\n result.maximum.set(0, 0, 0);\n result.center.set(0, 0, 0);\n result.halfDiagonal.set(0, 0, 0);\n return result;\n }\n\n let minimumX = positions[0][0];\n let minimumY = positions[0][1];\n let minimumZ = positions[0][2];\n\n let maximumX = positions[0][0];\n let maximumY = positions[0][1];\n let maximumZ = positions[0][2];\n\n for (const p of positions) {\n const x = p[0];\n const y = p[1];\n const z = p[2];\n\n minimumX = Math.min(x, minimumX);\n maximumX = Math.max(x, maximumX);\n minimumY = Math.min(y, minimumY);\n maximumY = Math.max(y, maximumY);\n minimumZ = Math.min(z, minimumZ);\n maximumZ = Math.max(z, maximumZ);\n }\n\n result.minimum.set(minimumX, minimumY, minimumZ);\n result.maximum.set(maximumX, maximumY, maximumZ);\n result.center.copy(result.minimum).add(result.maximum).scale(0.5);\n result.halfDiagonal.copy(result.maximum).subtract(result.center);\n\n return result;\n}\n", "// math.gl\n// SPDX-License-Identifier: MIT and Apache-2.0\n// Copyright (c) vis.gl contributors\n\n// This file is derived from the Cesium math library under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {Matrix3, _MathUtils} from '@math.gl/core';\n\nconst scratchMatrix = new Matrix3();\nconst scratchUnitary = new Matrix3();\nconst scratchDiagonal = new Matrix3();\n\nconst jMatrix = new Matrix3();\nconst jMatrixTranspose = new Matrix3();\n\nexport type EigenDecomposition = {\n unitary: Matrix3;\n diagonal: Matrix3;\n};\n\n/**\n * Computes the eigenvectors and eigenvalues of a symmetric matrix.\n *\n * - Returns a diagonal matrix and unitary matrix such that:\n * `matrix = unitary matrix * diagonal matrix * transpose(unitary matrix)`\n * - The values along the diagonal of the diagonal matrix are the eigenvalues. The columns\n * of the unitary matrix are the corresponding eigenvectors.\n * - This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan,\n * section 8.4.3 The Classical Jacobi Algorithm\n *\n * @param matrix The 3x3 matrix to decompose into diagonal and unitary matrix. Expected to be symmetric.\n * @param result Optional object with unitary and diagonal properties which are matrices onto which to store the result.\n * @returns An object with unitary and diagonal properties which are the unitary and diagonal matrices, respectively.\n *\n * @example\n * const a = //... symmetric matrix\n * const result = {\n * unitary : new Matrix3(),\n * diagonal : new Matrix3()\n * };\n * computeEigenDecomposition(a, result);\n *\n * const unitaryTranspose = Matrix3.transpose(result.unitary, new Matrix3());\n * const b = Matrix3.multiply(result.unitary, result.diagonal, new Matrix3());\n * Matrix3.multiply(b, unitaryTranspose, b); // b is now equal to a\n *\n * const lambda = result.diagonal.getColumn(0, new Vector3()).x; // first eigenvalue\n * const v = result.unitary.getColumn(0, new Vector3()); // first eigenvector\n * const c = v.multiplyByScalar(lambda); // equal to v.transformByMatrix3(a)\n */\nexport function computeEigenDecomposition(\n matrix: number[],\n // @ts-expect-error accept empty object type\n result: EigenDecomposition = {}\n): EigenDecomposition {\n const EIGEN_TOLERANCE = _MathUtils.EPSILON20;\n const EIGEN_MAX_SWEEPS = 10;\n\n let count = 0;\n let sweep = 0;\n\n const unitaryMatrix = scratchUnitary;\n const diagonalMatrix = scratchDiagonal;\n\n unitaryMatrix.identity();\n diagonalMatrix.copy(matrix);\n\n const epsilon = EIGEN_TOLERANCE * computeFrobeniusNorm(diagonalMatrix);\n\n while (sweep < EIGEN_MAX_SWEEPS && offDiagonalFrobeniusNorm(diagonalMatrix) > epsilon) {\n shurDecomposition(diagonalMatrix, jMatrix);\n\n jMatrixTranspose.copy(jMatrix).transpose();\n\n diagonalMatrix.multiplyRight(jMatrix);\n diagonalMatrix.multiplyLeft(jMatrixTranspose);\n unitaryMatrix.multiplyRight(jMatrix);\n\n if (++count > 2) {\n ++sweep;\n count = 0;\n }\n }\n\n result.unitary = unitaryMatrix.toTarget(result.unitary);\n result.diagonal = diagonalMatrix.toTarget(result.diagonal);\n\n return result;\n}\n\nfunction computeFrobeniusNorm(matrix: Matrix3): number {\n let norm = 0.0;\n for (let i = 0; i < 9; ++i) {\n const temp = matrix[i];\n norm += temp * temp;\n }\n return Math.sqrt(norm);\n}\n\nconst rowVal = [1, 0, 0];\nconst colVal = [2, 2, 1];\n\n// Computes the \"off-diagonal\" Frobenius norm.\n// Assumes matrix is symmetric.\nfunction offDiagonalFrobeniusNorm(matrix: Matrix3): number {\n let norm = 0.0;\n for (let i = 0; i < 3; ++i) {\n const temp = matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])];\n norm += 2.0 * temp * temp;\n }\n return Math.sqrt(norm);\n}\n\n// The routine takes a matrix, which is assumed to be symmetric, and\n// finds the largest off-diagonal term, and then creates\n// a matrix (result) which can be used to help reduce it\n//\n// This routine was created based upon Matrix Computations, 3rd ed., by Golub and Van Loan,\n// section 8.4.2 The 2by2 Symmetric Schur Decomposition.\n//\n// eslint-disable-next-line max-statements\nfunction shurDecomposition(matrix: Matrix3, result: Matrix3): Matrix3 {\n const tolerance = _MathUtils.EPSILON15;\n\n let maxDiagonal = 0.0;\n let rotAxis = 1;\n\n // find pivot (rotAxis) based on max diagonal of matrix\n for (let i = 0; i < 3; ++i) {\n const temp = Math.abs(matrix[scratchMatrix.getElementIndex(colVal[i], rowVal[i])]);\n if (temp > maxDiagonal) {\n rotAxis = i;\n maxDiagonal = temp;\n }\n }\n\n const p = rowVal[rotAxis];\n const q = colVal[rotAxis];\n\n let c = 1.0;\n let s = 0.0;\n\n if (Math.abs(matrix[scratchMatrix.getElementIndex(q, p)]) > tolerance) {\n const qq = matrix[scratchMatrix.getElementIndex(q, q)];\n const pp = matrix[scratchMatrix.getElementIndex(p, p)];\n const qp = matrix[scratchMatrix.getElementIndex(q, p)];\n\n const tau = (qq - pp) / 2.0 / qp;\n let t;\n\n if (tau < 0.0) {\n t = -1.0 / (-tau + Math.sqrt(1.0 + tau * tau));\n } else {\n t = 1.0 / (tau + Math.sqrt(1.0 + tau * tau));\n }\n\n c = 1.0 / Math.sqrt(1.0 + t * t);\n s = t * c;\n }\n\n // Copy into result\n Matrix3.IDENTITY.to(result);\n result[scratchMatrix.getElementIndex(p, p)] = result[scratchMatrix.getElementIndex(q, q)] = c;\n result[scratchMatrix.getElementIndex(q, p)] = s;\n result[scratchMatrix.getElementIndex(p, q)] = -s;\n\n return result;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;ACIO,IAAM,eAAe;EAC1B,SAAS;;EACT,cAAc;;EACd,QAAQ;;;;;ACFV,kBAAsB;AAItB,IAAM,gBAAgB,IAAI,oBAAO;AACjC,IAAM,gBAAgB,IAAI,oBAAO;AAQ3B,IAAO,yBAAP,MAA6B;;;;;;;EAgBjC,YACE,UAA6B,CAAC,GAAG,GAAG,CAAC,GACrC,UAA6B,CAAC,GAAG,GAAG,CAAC,GACrC,QAA0B;AAG1B,aAAS,UAAU,cAAc,KAAK,OAAO,EAAE,IAAI,OAAO,EAAE,MAAM,GAAG;AACrE,SAAK,SAAS,IAAI,oBAAQ,MAAM;AAChC,SAAK,eAAe,IAAI,oBAAQ,OAAO,EAAE,SAAS,KAAK,MAAM;AAO7D,SAAK,UAAU,IAAI,oBAAQ,OAAO;AAOlC,SAAK,UAAU,IAAI,oBAAQ,OAAO;EACpC;;;;;;EAOA,QAAK;AACH,WAAO,IAAI,uBAAuB,KAAK,SAAS,KAAK,SAAS,KAAK,MAAM;EAC3E;;;;;;;;EASA,OAAO,OAA6B;AAClC,WACE,SAAS,SACR,QAAQ,KAAK,KAAK,KAAK,QAAQ,OAAO,MAAM,OAAO,KAAK,KAAK,QAAQ,OAAO,MAAM,OAAO;EAE9F;;;;;;EAOA,UAAU,WAA4B;AACpC,SAAK,OAAO,iBAAiB,SAAS;AAEtC,SAAK,aAAa,UAAU,SAAS;AACrC,SAAK,QAAQ,UAAU,SAAS;AAChC,SAAK,QAAQ,UAAU,SAAS;AAChC,WAAO;EACT;;;;EAKA,eAAe,OAAY;AACzB,UAAM,EAAC,aAAY,IAAI;AACvB,UAAM,SAAS,cAAc,KAAK,MAAM,MAAM;AAC9C,UAAM,IACJ,aA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U,UAAU,QAAQ;AAC/C,SAAO,OAAO,KAAK,OAAO,OAAO,EAAE,IAAI,OAAO,OAAO,EAAE,MAAM,GAAG;AAChE,SAAO,aAAa,KAAK,OAAO,OAAO,EAAE,SAAS,OAAO,MAAM;AAE/D,SAAO;AACT;",
6
+ "names": ["import_core", "scratchVector", "scratchVector2", "import_core", "import_core", "import_core", "scratchNormal", "import_core", "import_core", "scratchPlaneNormal", "import_core", "import_core", "import_core", "import_core", "scratchVector2", "scratchVector3"]
7
7
  }
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { BoundingSphere } from "./lib/bounding-volumes/bounding-sphere.js";
4
4
  export { OrientedBoundingBox } from "./lib/bounding-volumes/oriented-bounding-box.js";
5
5
  export { CullingVolume } from "./lib/culling-volume.js";
6
6
  export { Plane } from "./lib/plane.js";
7
+ export { Ray } from "./lib/ray.js";
7
8
  export { PerspectiveOffCenterFrustum as _PerspectiveOffCenterFrustum } from "./lib/perspective-off-center-frustum.js";
8
9
  export { PerspectiveFrustum as _PerspectiveFrustum } from "./lib/perspective-frustum.js";
9
10
  export { makeBoundingSphereFromPoints } from "./lib/algorithms/bounding-sphere-from-points.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAC,uBAAoB;AAEzC,OAAO,EAAC,sBAAsB,EAAC,4DAAyD;AACxF,OAAO,EAAC,cAAc,EAAC,kDAA+C;AACtE,OAAO,EAAC,mBAAmB,EAAC,wDAAqD;AACjF,OAAO,EAAC,aAAa,EAAC,gCAA6B;AACnD,OAAO,EAAC,KAAK,EAAC,uBAAoB;AAElC,OAAO,EAAC,2BAA2B,IAAI,4BAA4B,EAAC,gDAA6C;AACjH,OAAO,EAAC,kBAAkB,IAAI,mBAAmB,EAAC,qCAAkC;AAEpF,OAAO,EAAC,4BAA4B,EAAC,wDAAqD;AAC1F,OAAO,EACL,oCAAoC,EACpC,iCAAiC,EAClC,qDAAkD;AACnD,OAAO,EAAC,yBAAyB,EAAC,wDAAqD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAAC,uBAAoB;AAEzC,OAAO,EAAC,sBAAsB,EAAC,4DAAyD;AACxF,OAAO,EAAC,cAAc,EAAC,kDAA+C;AACtE,OAAO,EAAC,mBAAmB,EAAC,wDAAqD;AACjF,OAAO,EAAC,aAAa,EAAC,gCAA6B;AACnD,OAAO,EAAC,KAAK,EAAC,uBAAoB;AAClC,OAAO,EAAC,GAAG,EAAC,qBAAkB;AAE9B,OAAO,EAAC,2BAA2B,IAAI,4BAA4B,EAAC,gDAA6C;AACjH,OAAO,EAAC,kBAAkB,IAAI,mBAAmB,EAAC,qCAAkC;AAEpF,OAAO,EAAC,4BAA4B,EAAC,wDAAqD;AAC1F,OAAO,EACL,oCAAoC,EACpC,iCAAiC,EAClC,qDAAkD;AACnD,OAAO,EAAC,yBAAyB,EAAC,wDAAqD"}
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export { BoundingSphere } from "./lib/bounding-volumes/bounding-sphere.js";
7
7
  export { OrientedBoundingBox } from "./lib/bounding-volumes/oriented-bounding-box.js";
8
8
  export { CullingVolume } from "./lib/culling-volume.js";
9
9
  export { Plane } from "./lib/plane.js";
10
+ export { Ray } from "./lib/ray.js";
10
11
  export { PerspectiveOffCenterFrustum as _PerspectiveOffCenterFrustum } from "./lib/perspective-off-center-frustum.js";
11
12
  export { PerspectiveFrustum as _PerspectiveFrustum } from "./lib/perspective-frustum.js";
12
13
  export { makeBoundingSphereFromPoints } from "./lib/algorithms/bounding-sphere-from-points.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,YAAY,EAAC,uBAAoB;AAEzC,OAAO,EAAC,sBAAsB,EAAC,4DAAyD;AACxF,OAAO,EAAC,cAAc,EAAC,kDAA+C;AACtE,OAAO,EAAC,mBAAmB,EAAC,wDAAqD;AACjF,OAAO,EAAC,aAAa,EAAC,gCAA6B;AACnD,OAAO,EAAC,KAAK,EAAC,uBAAoB;AAElC,OAAO,EAAC,2BAA2B,IAAI,4BAA4B,EAAC,gDAA6C;AACjH,OAAO,EAAC,kBAAkB,IAAI,mBAAmB,EAAC,qCAAkC;AAEpF,OAAO,EAAC,4BAA4B,EAAC,wDAAqD;AAC1F,OAAO,EACL,oCAAoC,EACpC,iCAAiC,EAClC,qDAAkD;AACnD,OAAO,EAAC,yBAAyB,EAAC,wDAAqD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,YAAY,EAAC,uBAAoB;AAEzC,OAAO,EAAC,sBAAsB,EAAC,4DAAyD;AACxF,OAAO,EAAC,cAAc,EAAC,kDAA+C;AACtE,OAAO,EAAC,mBAAmB,EAAC,wDAAqD;AACjF,OAAO,EAAC,aAAa,EAAC,gCAA6B;AACnD,OAAO,EAAC,KAAK,EAAC,uBAAoB;AAClC,OAAO,EAAC,GAAG,EAAC,qBAAkB;AAE9B,OAAO,EAAC,2BAA2B,IAAI,4BAA4B,EAAC,gDAA6C;AACjH,OAAO,EAAC,kBAAkB,IAAI,mBAAmB,EAAC,qCAAkC;AAEpF,OAAO,EAAC,4BAA4B,EAAC,wDAAqD;AAC1F,OAAO,EACL,oCAAoC,EACpC,iCAAiC,EAClC,qDAAkD;AACnD,OAAO,EAAC,yBAAyB,EAAC,wDAAqD"}
@@ -2,7 +2,7 @@ import { NumericArray } from '@math.gl/types';
2
2
  import { Vector3, Matrix3, Matrix4, Quaternion } from '@math.gl/core';
3
3
  import type { BoundingVolume } from "./bounding-volume.js";
4
4
  import { BoundingSphere } from "./bounding-sphere.js";
5
- import type { Plane } from "../plane.js";
5
+ import { Plane } from "../plane.js";
6
6
  /**
7
7
  * An OrientedBoundingBox of some object is a closed and convex cuboid.
8
8
  * It can provide a tighter bounding volume than `BoundingSphere` or
@@ -1 +1 @@
1
- {"version":3,"file":"oriented-bounding-box.d.ts","sourceRoot":"","sources":["../../../src/lib/bounding-volumes/oriented-bounding-box.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,KAAK,EAAC,cAAc,EAAC,6BAA0B;AACtD,OAAO,EAAC,cAAc,EAAC,6BAA0B;AACjD,OAAO,KAAK,EAAC,KAAK,EAAC,oBAAiB;AAuBpC;;;;GAIG;AACH,qBAAa,mBAAoB,YAAW,cAAc;IACxD,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAElB;;;;OAIG;gBACS,MAAM,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IAS9E,iEAAiE;IACjE,IAAI,QAAQ,IAAI,MAAM,EAAE,CAKvB;IAED,0EAA0E;IAC1E,IAAI,UAAU,IAAI,UAAU,CAQ3B;IAED;;OAEG;IACH,4BAA4B,CAC1B,MAAM,EAAE,MAAM,EAAE,EAChB,QAAQ,EAAE,MAAM,EAAE,EAClB,UAAU,EAAE,MAAM,EAAE,GACnB,mBAAmB;IAiBtB,iDAAiD;IACjD,KAAK,IAAI,mBAAmB;IAI5B,2EAA2E;IAC3E,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO;IAO3C,6FAA6F;IAC7F,iBAAiB,CAAC,MAAM,iBAAuB,GAAG,cAAc;IAehE,6EAA6E;IAC7E,cAAc,CAAC,KAAK,EAAE,KAAK,GAA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AAc,CAAC,CAAC;QAEvC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;QACzD,KAAK,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAEvC,IAAI,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,YAAY;QACV,iHAAiH;QACjH,sBAAsB;QACtB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -1,4 +1,5 @@
1
1
  import { Vector3, NumericArray } from '@math.gl/core';
2
+ import { Ray } from "./ray.js";
2
3
  export declare class Plane {
3
4
  readonly normal: Vector3;
4
5
  distance: number;
@@ -22,5 +23,13 @@ export declare class Plane {
22
23
  /** Projects a point onto the plane. */
23
24
  projectPointOntoPlane(point: Readonly<NumericArray>, result: Vector3): Vector3;
24
25
  projectPointOntoPlane(point: Readonly<NumericArray>, result?: readonly number[]): readonly number[];
26
+ /**
27
+ * Computes the intersection of a ray and this plane.
28
+ *
29
+ * @param {Ray} ray The ray.
30
+ * @param {Vector3} [result] The object onto which to store the result.
31
+ * @returns {Vector3} The intersection point or undefined if there is no intersections.
32
+ */
33
+ intersectWithRay(ray: Ray, result?: Vector3): Vector3;
25
34
  }
26
35
  //# sourceMappingURL=plane.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plane.d.ts","sourceRoot":"","sources":["../../src/lib/plane.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,OAAO,EAAkB,YAAY,EAAC,MAAM,eAAe,CAAC;AAMpE,qBAAa,KAAK;IAChB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;gBAEL,MAAM,GAAE,QAAQ,CAAC,YAAY,CAAa,EAAE,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,GAAE,MAAU;IAM5E,oEAAoE;IACpE,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAO1E,8DAA8D;IAC9D,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,IAAI;IAQpF,gDAAgD;IAChD,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAOlE,mCAAmC;IACnC,KAAK,IAAI,KAAK;IAId,0DAA0D;IAC1D,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAI7B;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,MAAM;IAIvD,+DAA+D;IAC/D,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,IAAI;IAMhD,uCAAuC;IACvC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;IAC9E,qBAAqB,CACnB,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,EAC7B,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GACzB,SAAS,MAAM,EAAE;IAWpB;;;;;;OAMG;IACH,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO;CAqBtD"}
package/dist/lib/plane.js CHANGED
@@ -4,7 +4,7 @@
4
4
  // This file is derived from the Cesium math library under Apache 2 license
5
5
  // See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
6
6
  /* eslint-disable */
7
- import { Vector3, equals, assert } from '@math.gl/core';
7
+ import { Vector3, equals, assert, _MathUtils } from '@math.gl/core';
8
8
  const scratchPosition = new Vector3();
9
9
  const scratchNormal = new Vector3();
10
10
  // A plane in Hessian Normal Form
@@ -63,5 +63,29 @@ export class Plane {
63
63
  const scaledNormal = scratchNormal.copy(this.normal).scale(pointDistance);
64
64
  return scratchPoint.subtract(scaledNormal).to(result);
65
65
  }
66
+ /**
67
+ * Computes the intersection of a ray and this plane.
68
+ *
69
+ * @param {Ray} ray The ray.
70
+ * @param {Vector3} [result] The object onto which to store the result.
71
+ * @returns {Vector3} The intersection point or undefined if there is no intersections.
72
+ */
73
+ intersectWithRay(ray, result) {
74
+ if (!result)
75
+ result = new Vector3();
76
+ const origin = ray.origin;
77
+ const direction = ray.direction;
78
+ const normal = this.normal;
79
+ const denominator = normal.dot(direction);
80
+ if (Math.abs(denominator) < _MathUtils.EPSILON15) {
81
+ return undefined;
82
+ }
83
+ const t = (-this.distance - normal.dot(origin)) / denominator;
84
+ if (t < 0) {
85
+ return undefined;
86
+ }
87
+ result = result.copy(direction).multiplyByScalar(t);
88
+ return origin.add(result);
89
+ }
66
90
  }
67
91
  //# sourceMappingURL=plane.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plane.js","sourceRoot":"","sources":["../../src/lib/plane.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,8CAA8C;AAC9C,oCAAoC;AAEpC,2EAA2E;AAC3E,4FAA4F;AAE5F,oBAAoB;AACpB,OAAO,EAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAe,MAAM,eAAe,CAAC;AAEpE,MAAM,eAAe,GAAG,IAAI,OAAO,EAAE,CAAC;AACtC,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;AAEpC,iCAAiC;AACjC,MAAM,OAAO,KAAK;IAIhB,YAAY,SAAiC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,WAAmB,CAAC;QAC1E,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,C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+ direction: Vector3;
5
+ /**
6
+ * Creates a new ray that extends infinitely from the provided origin in the provided direction.
7
+ *
8
+ * @param [origin=Vector3] The origin of the ray.
9
+ * @param [direction=Vector3] The direction of the ray.
10
+ */
11
+ constructor(origin?: Vector3, direction?: Vector3);
12
+ }
13
+ //# sourceMappingURL=ray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ray.d.ts","sourceRoot":"","sources":["../../src/lib/ray.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAGtC,qBAAa,GAAG;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;gBACS,MAAM,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,OAAO;CAUlD"}
@@ -0,0 +1,28 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT and Apache-2.0
3
+ // Copyright (c) vis.gl contributors
4
+ // This file is derived from the Cesium library under Apache 2 license
5
+ // See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
6
+ import { Vector3 } from '@math.gl/core';
7
+ /* Represents a ray that extends infinitely from the provided origin in the provided direction. */
8
+ export class Ray {
9
+ /**
10
+ * Creates a new ray that extends infinitely from the provided origin in the provided direction.
11
+ *
12
+ * @param [origin=Vector3] The origin of the ray.
13
+ * @param [direction=Vector3] The direction of the ray.
14
+ */
15
+ constructor(origin, direction) {
16
+ if (origin)
17
+ origin = origin.clone();
18
+ else
19
+ origin = new Vector3();
20
+ if (direction)
21
+ direction = direction.clone().normalize();
22
+ else
23
+ direction = new Vector3();
24
+ this.origin = origin;
25
+ this.direction = direction;
26
+ }
27
+ }
28
+ //# sourceMappingURL=ray.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ray.js","sourceRoot":"","sources":["../../src/lib/ray.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,8CAA8C;AAC9C,oCAAoC;AAEpC,sEAAsE;AACtE,4FAA4F;AAE5F,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAEtC,kGAAkG;AAClG,MAAM,OAAO,GAAG;IAId;;;;;OAKG;IACH,YAAY,MAAgB,EAAE,SAAmB;QAC/C,IAAI,MAAM;YAAE,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;;YAC/B,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAE5B,IAAI,SAAS;YAAE,SAAS,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,CAAC;;YACpD,SAAS,GAAG,IAAI,OAAO,EAAE,CAAC;QAE/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF"}
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
- "version": "4.1.0",
9
+ "version": "4.2.0-alpha.3",
10
10
  "keywords": [
11
11
  "webgl",
12
12
  "javascript",
@@ -42,8 +42,8 @@
42
42
  "src"
43
43
  ],
44
44
  "dependencies": {
45
- "@math.gl/core": "4.1.0",
46
- "@math.gl/types": "4.1.0"
45
+ "@math.gl/core": "4.2.0-alpha.3",
46
+ "@math.gl/types": "4.2.0-alpha.3"
47
47
  },
48
- "gitHead": "76820f54e2a9034b42bd24ffeb381cc4e01ad46e"
48
+ "gitHead": "4238aa95fb38da43a65c6e5f2b8343a875666d92"
49
49
  }
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ export {BoundingSphere} from './lib/bounding-volumes/bounding-sphere';
9
9
  export {OrientedBoundingBox} from './lib/bounding-volumes/oriented-bounding-box';
10
10
  export {CullingVolume} from './lib/culling-volume';
11
11
  export {Plane} from './lib/plane';
12
+ export {Ray} from './lib/ray';
12
13
 
13
14
  export {PerspectiveOffCenterFrustum as _PerspectiveOffCenterFrustum} from './lib/perspective-off-center-frustum';
14
15
  export {PerspectiveFrustum as _PerspectiveFrustum} from './lib/perspective-frustum';
@@ -7,9 +7,10 @@
7
7
 
8
8
  import {NumericArray} from '@math.gl/types';
9
9
  import {Vector3, Matrix3, Matrix4, Quaternion} from '@math.gl/core';
10
+
10
11
  import type {BoundingVolume} from './bounding-volume';
11
12
  import {BoundingSphere} from './bounding-sphere';
12
- import type {Plane} from '../plane';
13
+ import {Plane} from '../plane';
13
14
  import {INTERSECTION} from '../../constants';
14
15
 
15
16
  const scratchVector3 = new Vector3();
package/src/lib/plane.ts CHANGED
@@ -6,7 +6,8 @@
6
6
  // See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
7
7
 
8
8
  /* eslint-disable */
9
- import {Vector3, equals, assert, NumericArray} from '@math.gl/core';
9
+ import {Vector3, equals, assert, NumericArray, _MathUtils} from '@math.gl/core';
10
+ import {Ray} from './ray';
10
11
 
11
12
  const scratchPosition = new Vector3();
12
13
  const scratchNormal = new Vector3();
@@ -86,4 +87,33 @@ export class Plane {
86
87
 
87
88
  return scratchPoint.subtract(scaledNormal).to(result);
88
89
  }
90
+
91
+ /**
92
+ * Computes the intersection of a ray and this plane.
93
+ *
94
+ * @param {Ray} ray The ray.
95
+ * @param {Vector3} [result] The object onto which to store the result.
96
+ * @returns {Vector3} The intersection point or undefined if there is no intersections.
97
+ */
98
+ intersectWithRay(ray: Ray, result?: Vector3): Vector3 {
99
+ if (!result) result = new Vector3();
100
+
101
+ const origin = ray.origin;
102
+ const direction = ray.direction;
103
+ const normal = this.normal;
104
+ const denominator = normal.dot(direction);
105
+
106
+ if (Math.abs(denominator) < _MathUtils.EPSILON15) {
107
+ return undefined;
108
+ }
109
+
110
+ const t = (-this.distance - normal.dot(origin)) / denominator;
111
+
112
+ if (t < 0) {
113
+ return undefined;
114
+ }
115
+
116
+ result = result.copy(direction).multiplyByScalar(t);
117
+ return origin.add(result);
118
+ }
89
119
  }
package/src/lib/ray.ts ADDED
@@ -0,0 +1,31 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT and Apache-2.0
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ // This file is derived from the Cesium library under Apache 2 license
6
+ // See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
7
+
8
+ import {Vector3} from '@math.gl/core';
9
+
10
+ /* Represents a ray that extends infinitely from the provided origin in the provided direction. */
11
+ export class Ray {
12
+ origin: Vector3;
13
+ direction: Vector3;
14
+
15
+ /**
16
+ * Creates a new ray that extends infinitely from the provided origin in the provided direction.
17
+ *
18
+ * @param [origin=Vector3] The origin of the ray.
19
+ * @param [direction=Vector3] The direction of the ray.
20
+ */
21
+ constructor(origin?: Vector3, direction?: Vector3) {
22
+ if (origin) origin = origin.clone();
23
+ else origin = new Vector3();
24
+
25
+ if (direction) direction = direction.clone().normalize();
26
+ else direction = new Vector3();
27
+
28
+ this.origin = origin;
29
+ this.direction = direction;
30
+ }
31
+ }