@galacean/engine-math 0.0.0-experimental-0.9-plus.8 → 0.0.0-experimental-double11.1

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.
@@ -1128,6 +1128,50 @@ function _create_class(Constructor, protoProps, staticProps) {
1128
1128
  return true;
1129
1129
  };
1130
1130
  /**
1131
+ * Get the containment type between a frustum and a point.
1132
+ * @param frustum - The frustum
1133
+ * @param point - The point
1134
+ * @returns The containment type
1135
+ */ CollisionUtil.frustumContainsPoint = function frustumContainsPoint(frustum, point) {
1136
+ var distance = CollisionUtil.distancePlaneAndPoint(frustum.near, point);
1137
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1138
+ return exports.ContainmentType.Intersects;
1139
+ } else if (distance < 0) {
1140
+ return exports.ContainmentType.Disjoint;
1141
+ }
1142
+ distance = CollisionUtil.distancePlaneAndPoint(frustum.far, point);
1143
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1144
+ return exports.ContainmentType.Intersects;
1145
+ } else if (distance < 0) {
1146
+ return exports.ContainmentType.Disjoint;
1147
+ }
1148
+ distance = CollisionUtil.distancePlaneAndPoint(frustum.left, point);
1149
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1150
+ return exports.ContainmentType.Intersects;
1151
+ } else if (distance < 0) {
1152
+ return exports.ContainmentType.Disjoint;
1153
+ }
1154
+ distance = CollisionUtil.distancePlaneAndPoint(frustum.right, point);
1155
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1156
+ return exports.ContainmentType.Intersects;
1157
+ } else if (distance < 0) {
1158
+ return exports.ContainmentType.Disjoint;
1159
+ }
1160
+ distance = CollisionUtil.distancePlaneAndPoint(frustum.top, point);
1161
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1162
+ return exports.ContainmentType.Intersects;
1163
+ } else if (distance < 0) {
1164
+ return exports.ContainmentType.Disjoint;
1165
+ }
1166
+ distance = CollisionUtil.distancePlaneAndPoint(frustum.bottom, point);
1167
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1168
+ return exports.ContainmentType.Intersects;
1169
+ } else if (distance < 0) {
1170
+ return exports.ContainmentType.Disjoint;
1171
+ }
1172
+ return exports.ContainmentType.Contains;
1173
+ };
1174
+ /**
1131
1175
  * Get the containment type between a frustum and a box (AABB).
1132
1176
  * @param frustum - The frustum
1133
1177
  * @param box - The box
@@ -4625,10 +4669,11 @@ var Rect = /*#__PURE__*/ function() {
4625
4669
  if (y === void 0) y = 0;
4626
4670
  if (width === void 0) width = 0;
4627
4671
  if (height === void 0) height = 0;
4628
- this.x = x;
4629
- this.y = y;
4630
- this.width = width;
4631
- this.height = height;
4672
+ /** @internal */ this._onValueChanged = null;
4673
+ this._x = x;
4674
+ this._y = y;
4675
+ this._width = width;
4676
+ this._height = height;
4632
4677
  }
4633
4678
  var _proto = Rect.prototype;
4634
4679
  /**
@@ -4639,10 +4684,11 @@ var Rect = /*#__PURE__*/ function() {
4639
4684
  * @param height - The height of the rectangle, measured from the y position
4640
4685
  * @returns This rectangle
4641
4686
  */ _proto.set = function set(x, y, width, height) {
4642
- this.x = x;
4643
- this.y = y;
4644
- this.width = width;
4645
- this.height = height;
4687
+ this._x = x;
4688
+ this._y = y;
4689
+ this._width = width;
4690
+ this._height = height;
4691
+ this._onValueChanged && this._onValueChanged();
4646
4692
  return this;
4647
4693
  };
4648
4694
  /**
@@ -4656,12 +4702,63 @@ var Rect = /*#__PURE__*/ function() {
4656
4702
  * @param source - The specified rect
4657
4703
  * @returns This rect
4658
4704
  */ _proto.copyFrom = function copyFrom(source) {
4659
- this.x = source.x;
4660
- this.y = source.y;
4661
- this.width = source.width;
4662
- this.height = source.height;
4705
+ this._x = source.x;
4706
+ this._y = source.y;
4707
+ this._width = source.width;
4708
+ this._height = source.height;
4709
+ this._onValueChanged && this._onValueChanged();
4663
4710
  return this;
4664
4711
  };
4712
+ _create_class(Rect, [
4713
+ {
4714
+ key: "x",
4715
+ get: /**
4716
+ * The x coordinate of the rectangle.
4717
+ */ function get() {
4718
+ return this._x;
4719
+ },
4720
+ set: function set(value) {
4721
+ this._x = value;
4722
+ this._onValueChanged && this._onValueChanged();
4723
+ }
4724
+ },
4725
+ {
4726
+ key: "y",
4727
+ get: /**
4728
+ * The y coordinate of the rectangle.
4729
+ */ function get() {
4730
+ return this._y;
4731
+ },
4732
+ set: function set(value) {
4733
+ this._y = value;
4734
+ this._onValueChanged && this._onValueChanged();
4735
+ }
4736
+ },
4737
+ {
4738
+ key: "width",
4739
+ get: /**
4740
+ * The width of the rectangle, measured from the x position.
4741
+ */ function get() {
4742
+ return this._width;
4743
+ },
4744
+ set: function set(value) {
4745
+ this._width = value;
4746
+ this._onValueChanged && this._onValueChanged();
4747
+ }
4748
+ },
4749
+ {
4750
+ key: "height",
4751
+ get: /**
4752
+ * The height of the rectangle, measured from the y position.
4753
+ */ function get() {
4754
+ return this._height;
4755
+ },
4756
+ set: function set(value) {
4757
+ this._height = value;
4758
+ this._onValueChanged && this._onValueChanged();
4759
+ }
4760
+ }
4761
+ ]);
4665
4762
  return Rect;
4666
4763
  }();
4667
4764
 
package/dist/module.js CHANGED
@@ -1124,6 +1124,50 @@ function _create_class(Constructor, protoProps, staticProps) {
1124
1124
  return true;
1125
1125
  };
1126
1126
  /**
1127
+ * Get the containment type between a frustum and a point.
1128
+ * @param frustum - The frustum
1129
+ * @param point - The point
1130
+ * @returns The containment type
1131
+ */ CollisionUtil.frustumContainsPoint = function frustumContainsPoint(frustum, point) {
1132
+ var distance = CollisionUtil.distancePlaneAndPoint(frustum.near, point);
1133
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1134
+ return ContainmentType.Intersects;
1135
+ } else if (distance < 0) {
1136
+ return ContainmentType.Disjoint;
1137
+ }
1138
+ distance = CollisionUtil.distancePlaneAndPoint(frustum.far, point);
1139
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1140
+ return ContainmentType.Intersects;
1141
+ } else if (distance < 0) {
1142
+ return ContainmentType.Disjoint;
1143
+ }
1144
+ distance = CollisionUtil.distancePlaneAndPoint(frustum.left, point);
1145
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1146
+ return ContainmentType.Intersects;
1147
+ } else if (distance < 0) {
1148
+ return ContainmentType.Disjoint;
1149
+ }
1150
+ distance = CollisionUtil.distancePlaneAndPoint(frustum.right, point);
1151
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1152
+ return ContainmentType.Intersects;
1153
+ } else if (distance < 0) {
1154
+ return ContainmentType.Disjoint;
1155
+ }
1156
+ distance = CollisionUtil.distancePlaneAndPoint(frustum.top, point);
1157
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1158
+ return ContainmentType.Intersects;
1159
+ } else if (distance < 0) {
1160
+ return ContainmentType.Disjoint;
1161
+ }
1162
+ distance = CollisionUtil.distancePlaneAndPoint(frustum.bottom, point);
1163
+ if (Math.abs(distance) < MathUtil.zeroTolerance) {
1164
+ return ContainmentType.Intersects;
1165
+ } else if (distance < 0) {
1166
+ return ContainmentType.Disjoint;
1167
+ }
1168
+ return ContainmentType.Contains;
1169
+ };
1170
+ /**
1127
1171
  * Get the containment type between a frustum and a box (AABB).
1128
1172
  * @param frustum - The frustum
1129
1173
  * @param box - The box
@@ -4621,10 +4665,11 @@ var Rect = /*#__PURE__*/ function() {
4621
4665
  if (y === void 0) y = 0;
4622
4666
  if (width === void 0) width = 0;
4623
4667
  if (height === void 0) height = 0;
4624
- this.x = x;
4625
- this.y = y;
4626
- this.width = width;
4627
- this.height = height;
4668
+ /** @internal */ this._onValueChanged = null;
4669
+ this._x = x;
4670
+ this._y = y;
4671
+ this._width = width;
4672
+ this._height = height;
4628
4673
  }
4629
4674
  var _proto = Rect.prototype;
4630
4675
  /**
@@ -4635,10 +4680,11 @@ var Rect = /*#__PURE__*/ function() {
4635
4680
  * @param height - The height of the rectangle, measured from the y position
4636
4681
  * @returns This rectangle
4637
4682
  */ _proto.set = function set(x, y, width, height) {
4638
- this.x = x;
4639
- this.y = y;
4640
- this.width = width;
4641
- this.height = height;
4683
+ this._x = x;
4684
+ this._y = y;
4685
+ this._width = width;
4686
+ this._height = height;
4687
+ this._onValueChanged && this._onValueChanged();
4642
4688
  return this;
4643
4689
  };
4644
4690
  /**
@@ -4652,12 +4698,63 @@ var Rect = /*#__PURE__*/ function() {
4652
4698
  * @param source - The specified rect
4653
4699
  * @returns This rect
4654
4700
  */ _proto.copyFrom = function copyFrom(source) {
4655
- this.x = source.x;
4656
- this.y = source.y;
4657
- this.width = source.width;
4658
- this.height = source.height;
4701
+ this._x = source.x;
4702
+ this._y = source.y;
4703
+ this._width = source.width;
4704
+ this._height = source.height;
4705
+ this._onValueChanged && this._onValueChanged();
4659
4706
  return this;
4660
4707
  };
4708
+ _create_class(Rect, [
4709
+ {
4710
+ key: "x",
4711
+ get: /**
4712
+ * The x coordinate of the rectangle.
4713
+ */ function get() {
4714
+ return this._x;
4715
+ },
4716
+ set: function set(value) {
4717
+ this._x = value;
4718
+ this._onValueChanged && this._onValueChanged();
4719
+ }
4720
+ },
4721
+ {
4722
+ key: "y",
4723
+ get: /**
4724
+ * The y coordinate of the rectangle.
4725
+ */ function get() {
4726
+ return this._y;
4727
+ },
4728
+ set: function set(value) {
4729
+ this._y = value;
4730
+ this._onValueChanged && this._onValueChanged();
4731
+ }
4732
+ },
4733
+ {
4734
+ key: "width",
4735
+ get: /**
4736
+ * The width of the rectangle, measured from the x position.
4737
+ */ function get() {
4738
+ return this._width;
4739
+ },
4740
+ set: function set(value) {
4741
+ this._width = value;
4742
+ this._onValueChanged && this._onValueChanged();
4743
+ }
4744
+ },
4745
+ {
4746
+ key: "height",
4747
+ get: /**
4748
+ * The height of the rectangle, measured from the y position.
4749
+ */ function get() {
4750
+ return this._height;
4751
+ },
4752
+ set: function set(value) {
4753
+ this._height = value;
4754
+ this._onValueChanged && this._onValueChanged();
4755
+ }
4756
+ }
4757
+ ]);
4661
4758
  return Rect;
4662
4759
  }();
4663
4760