@galacean/engine-math 0.9.0-beta.80 → 1.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +44 -0
- package/dist/browser.min.js +1 -1
- package/dist/main.js +44 -0
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +44 -0
- package/dist/module.js +44 -0
- package/dist/module.js.map +1 -1
- package/package.json +1 -1
- package/types/CollisionUtil.d.ts +7 -0
package/dist/miniprogram.js
CHANGED
|
@@ -1110,6 +1110,50 @@ BoundingBox._tempVec31 = new Vector3();
|
|
|
1110
1110
|
return true;
|
|
1111
1111
|
};
|
|
1112
1112
|
/**
|
|
1113
|
+
* Get the containment type between a frustum and a point.
|
|
1114
|
+
* @param frustum - The frustum
|
|
1115
|
+
* @param point - The point
|
|
1116
|
+
* @returns The containment type
|
|
1117
|
+
*/ CollisionUtil.frustumContainsPoint = function frustumContainsPoint(frustum, point) {
|
|
1118
|
+
var distance = CollisionUtil.distancePlaneAndPoint(frustum.near, point);
|
|
1119
|
+
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
1120
|
+
return exports.ContainmentType.Intersects;
|
|
1121
|
+
} else if (distance < 0) {
|
|
1122
|
+
return exports.ContainmentType.Disjoint;
|
|
1123
|
+
}
|
|
1124
|
+
distance = CollisionUtil.distancePlaneAndPoint(frustum.far, point);
|
|
1125
|
+
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
1126
|
+
return exports.ContainmentType.Intersects;
|
|
1127
|
+
} else if (distance < 0) {
|
|
1128
|
+
return exports.ContainmentType.Disjoint;
|
|
1129
|
+
}
|
|
1130
|
+
distance = CollisionUtil.distancePlaneAndPoint(frustum.left, point);
|
|
1131
|
+
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
1132
|
+
return exports.ContainmentType.Intersects;
|
|
1133
|
+
} else if (distance < 0) {
|
|
1134
|
+
return exports.ContainmentType.Disjoint;
|
|
1135
|
+
}
|
|
1136
|
+
distance = CollisionUtil.distancePlaneAndPoint(frustum.right, 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.top, 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.bottom, 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
|
+
return exports.ContainmentType.Contains;
|
|
1155
|
+
};
|
|
1156
|
+
/**
|
|
1113
1157
|
* Get the containment type between a frustum and a box (AABB).
|
|
1114
1158
|
* @param frustum - The frustum
|
|
1115
1159
|
* @param box - The box
|
package/dist/module.js
CHANGED
|
@@ -1106,6 +1106,50 @@ BoundingBox._tempVec31 = new Vector3();
|
|
|
1106
1106
|
return true;
|
|
1107
1107
|
};
|
|
1108
1108
|
/**
|
|
1109
|
+
* Get the containment type between a frustum and a point.
|
|
1110
|
+
* @param frustum - The frustum
|
|
1111
|
+
* @param point - The point
|
|
1112
|
+
* @returns The containment type
|
|
1113
|
+
*/ CollisionUtil.frustumContainsPoint = function frustumContainsPoint(frustum, point) {
|
|
1114
|
+
var distance = CollisionUtil.distancePlaneAndPoint(frustum.near, point);
|
|
1115
|
+
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
1116
|
+
return ContainmentType.Intersects;
|
|
1117
|
+
} else if (distance < 0) {
|
|
1118
|
+
return ContainmentType.Disjoint;
|
|
1119
|
+
}
|
|
1120
|
+
distance = CollisionUtil.distancePlaneAndPoint(frustum.far, point);
|
|
1121
|
+
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
1122
|
+
return ContainmentType.Intersects;
|
|
1123
|
+
} else if (distance < 0) {
|
|
1124
|
+
return ContainmentType.Disjoint;
|
|
1125
|
+
}
|
|
1126
|
+
distance = CollisionUtil.distancePlaneAndPoint(frustum.left, point);
|
|
1127
|
+
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
1128
|
+
return ContainmentType.Intersects;
|
|
1129
|
+
} else if (distance < 0) {
|
|
1130
|
+
return ContainmentType.Disjoint;
|
|
1131
|
+
}
|
|
1132
|
+
distance = CollisionUtil.distancePlaneAndPoint(frustum.right, 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.top, 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.bottom, point);
|
|
1145
|
+
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
1146
|
+
return ContainmentType.Intersects;
|
|
1147
|
+
} else if (distance < 0) {
|
|
1148
|
+
return ContainmentType.Disjoint;
|
|
1149
|
+
}
|
|
1150
|
+
return ContainmentType.Contains;
|
|
1151
|
+
};
|
|
1152
|
+
/**
|
|
1109
1153
|
* Get the containment type between a frustum and a box (AABB).
|
|
1110
1154
|
* @param frustum - The frustum
|
|
1111
1155
|
* @param box - The box
|