@galacean/engine-math 0.9.0 → 1.0.0-beta.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.
@@ -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
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