Separate axis Testing)

Source: Internet
Author: User

Separate axis testing is a common and effective method for space collision detection. Its principle comes from the separation hyperplane theorem in the set analysis.
Hyper-plane theorem): If the two sets a and B do not intersect, there must be a separation hyperplane P, and so that A and B are located on different sides of P. This theorem applies to convex and concave sets in spatial data. When a dataset is a convex dataset, the separation hyperplane here is a space plane. When a dataset is a concave dataset, the separation hyperplane here is no longer a space plane, but a space surface.

Use a spatial plane to separate two Convex Sets

 

Use a spatial surface to separate a convex set and a concave set

 

Here we will only discuss the separation test using the spatial plane as the two convex sets of the separation surface, because the separation test using the surface is much more complicated than the separation test of the plane. For plane P that separates two convex sets, we take a straight line parallel to its normal vector as the Separation Axis of the Two convex sets. Here, the direction of the straight line is limited by the method vector of the separation plane. The position and end of the line are limited, so we can regard it as a linear cluster.

To perform a set intersection test on the Separation Axis, first observe the spatial mathematical characteristics of the data set on the Separation Axis. As shown in, the center of the Two convex sets is Ca and CB, the plane for separating them is P, and the corresponding Separation Axis is L. First, the distance d between the two sets is calculated, and then the maximum radius RA and Rb of the Two convex sets projected in the direction of the Separation Axis are obtained respectively (note: here, the maximum radius is obtained by projection to the Separation Axis, rather than the maximum radius in any direction ). Through observation, we can obtain the mathematical relationship between D, Ra, and Rb, that is, Ra.
+ RB <D. This is the spatial mathematical characteristics of the two convex sets on the Separation Axis. It is also the basis for us to use the separation axis for the intersection test.

 

For Two convex sets, we need to determine the spatial relationship between them. We only need to find the potential separation axis between them, and then determine whether the separation conditions are met on the Separation Axis. If two convex sets do not intersection, there must be a plane that can separate them, that is, there must be a separation axis that meets the separation conditions. In this case, we need to find all the potential separation planes, that is, the potential Separation Axis. For a convex set composed of a polygon, the intersection of the two geometries can be classified as the following: face-surface, face-edge, face-point, edge-edge, edge-point, and point-point intersection, they can also be processed as degraded edges. In this way, the intersection of two convex sets can be simplified: Surface-plane, surface-edge, and edge-edge. For the preceding three simplified intersection modes, we can consider them one by one and find all the hidden separation axes. In this way, we can obtain that the potential separation plane between Two convex sets may exist in the following positions:

1. The plane of each polygon in Convex Set.

2. The plane of each polygon in Convex Set B.

3. Public vertical planes between each side of Convex Set A and each side of Convex Set B.

The direction of the corresponding Separation Axis is:

1. The normal vector of each polygon in Convex Set.

2. Normal Vector of each polygon in Convex Set B.

3. The normal vector of the common vertical plane between each side of Convex Set A and that of each side of Convex Set B, that is, the cross multiplication direction of the two edge direction vectors.

Assume that Convex Set A contains fa surface and EA side, and convex set contains FB side and EB side.
+ FB + EA * the potential split axis of EB is large in some cases, therefore, in actual situations, we often need to simplify it based on the spatial characteristics of the specific geometric element. For example, for the intersection test between two obbs, because the two sides of the six sides of the OBB are parallel, in this way, we can reduce the number of separation axes between faces by half, and also reduce the number of separation axes between sides by half, which makes the situation much easier.

To sum up the above content, we can obtain the following steps to use the Separation Axis Test to determine the intersection between Two convex sets:

1. analyze all potential separation axes between them based on the specific conditions of the convex set, and perform separation tests for each Separation Axis.

2. For each Separation Axis L, perform projection calculation to obtain the D, Ra, and Rb, and obtain the separation relationship based on the relationship between them. If D
> Ra + RB: The separation plane exists, that is, the two sets do not intersect. In this case, the Judgment program can be exited in time. On the contrary, the two sets are not separated under the Separation Axis, but it cannot indicate that the two sets are intersecting.

3. If the existence of the separation plane is illegally confirmed by the judgment results of all potential separation axes, the two convex sets must be intersecting.

In general, the biggest cost in the above operations is to calculate the values of D, Ra, and Rb, because these values need to be updated for each split axis to be tested, it is also the most important part of mathematical computing. The simplest method is to project, compare, and obtain the RA and Rb values from all vertices in the set to the Separation Axis for each set, however, the complexity of computing is linearly related to the scale of the set, so the cost is high. Therefore, in implementation, we also need to perform corresponding analysis based on the spatial characteristics of the specific geometric set to simplify this step. For example, specific AABB, OBB, cyliner, and sphere can be simplified to improve the efficiency of the intersection test.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.