@galacean/engine-math 0.0.0-experimental-0.9-plus.8 → 0.0.0-experimental-ktx2.0
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 +109 -12
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +109 -12
- package/dist/module.js +109 -12
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/CollisionUtil.d.ts +7 -0
- package/types/Rect.d.ts +20 -8
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.
|
|
4629
|
-
this.
|
|
4630
|
-
this.
|
|
4631
|
-
this.
|
|
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.
|
|
4643
|
-
this.
|
|
4644
|
-
this.
|
|
4645
|
-
this.
|
|
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.
|
|
4660
|
-
this.
|
|
4661
|
-
this.
|
|
4662
|
-
this.
|
|
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
|
|