@galacean/engine-math 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -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