All the following articles are reproduced (http://blog.csdn.net/acmaker/article/details/3176910) reproduced please indicate the source.
1, rotating jam-translation documentation
A period of time before looking at a foreign Daniel's website, is about rotating jam technology, content is very good, try to translate a bit.
About rotating jam technology, the earliest is in Rujia, Huang Liang "algorithm Art and Informatics Contest", is the calculation of geometry-related technology, began to feel very magical, because of the problem of convex polygon gave a very good solution, so the Internet to check a bit, found this information.
Through personal learning research, I found that it can be used to solve a large number of polygon problems, rather than only the original understanding of the convex hull-based specific problems, very valuable research, so sent to share with you.
Due to the limited personal level, some places may not translate well, especially some nouns close to literal translation, there are some professional terms have not been studied so not translated. For example, Anti-podal as far as I know there is a "heel point" of the naming method, very appropriate, "heel" of the construction method is two points in turn along the periphery of the movement, very appropriate, but the text of another similar noun co-podal how to translate it. Although know the meaning, but I really can not find a good word, so I according to its similar to heel point, according to its operation for the moment called "heel point", very far-fetched; As for motion planning, Visibility,range fitting,scattered The words "data interpolation" and "finite element method" Do not really know how to translate, because they are some of the specific subjects, such as motion planning is about the robot, is I have never been involved in the subject, So I left the English name in the translation.
Although it was published ten years ago, but the article proposed 15 specific problems of the realization is very worthwhile to learn, gossip less, the following articles will be the specific content of the literature.
Rotating Jam--catalog page history: in 1978, the paper "Computational Geometry", M.i Shamos's Ph.D, marked the birth of this field of computer science. What he was doing was a very simple algorithm for finding the diameter of a convex polygon, which is determined by the maximum value of a pair of points of a polygon.
Later, the diameter evolved to be determined by a pair of pairs of heel points. Shamos presents a simple O (n) time algorithm to determine the pair of heel points for a convex n-angle shape. Because they have up to 3 n/2, the diameter can be calculated in O (n) time.
As Toussaint later proposed, the Shamos algorithm is like rotating a pair of jams around a polygon. So there is the term "spin jam". In 1983, Toussaint published a paper that uses the same techniques to solve many problems. Since then, the new algorithm based on this model has been established and solved many problems.
They include:
Calculate distance convex polygon diameter convex polygon wide convex polygon maximum distance convex polygon minimum distance external rectangle minimum area external rectangle minimum perimeter external rectangle triangular split onion triangular split helical triangular split quadrilateral polygon attribute combined convex hull finding common tangent convex polygon intersection critical tangent convex polygon vector and Thinnest cross section
Original address: http://cgm.cs.mcgill.ca/~orm/rotcal.frame.html
rotating jam--convex polygon diameter Polygon Diameter We define the maximum distance between any two points on a polygon as the diameter of the polygon. It is possible to determine the point logarithm of this diameter by more than one pair. In fact, for polygons with n vertices, there may be n pairs of "diameter point pairs".
A simple example of a polygon diameter is shown in the diagram on the left. The diameter point pairs are shown as black dots (red pairs of parallel lines) that are crossed by parallel lines in the diagram. The diameter is highlighted in light blue.
Clearly, it is not possible to determine the point pair of a convex polygon p diameter inside the polygon p. So the search should be done on the border. In fact, because the diameter is determined by the farthest distance of the polygon's parallel tangent, we only need to query the heel point. Shamos (1978) provides an O (n) time complexity algorithm for calculating n-point convex hull pairs of heel points. Diameter by traversing the list of vertices, the maximum distance can be obtained. The following is the pseudo-code for the Shamos algorithm published in the Preparata and Shamos articles in 1985.
The input is a polygon p={p1,..., pn}.
Begin
P0:=PN;
Q:=NEXT[P];
while (area (p,next[p],next[q) > Area (p,next[p],q)) do
q:=next[q];
q0:=q;
while (q! = p0) do
begin
P:=next[p];
Print (p,q);
while (area (p,next[p],next[q) > Area (p,next[p],q) does
begin
Q:=next[q];
if ((p,q)! = (q0,p0)) then Print (p,q)
else return
end;
if (area (p,next[p],next[q]) = Area (p,next[p],q)) then
if ((p,q)! = (q0,p0)) then print (P,next[q])
else print ( NEXT[P],Q)
end
end.
Here Print (p,q) means (p,q) as a pair of heel point to output, area (P,q,r) represents the direction of the Triangle PQR.
Although this process is visually different from conventional rotational jam algorithms, they are essentially the same, and avoid all angles of calculation.
The following is a more intuitive algorithm: computes the endpoint in the Y-direction of the polygon. We call it ymin and Ymax. Construct two horizontal tangents through ymin and Ymax. Since they are already a pair of heel points, calculate the distance between them and maintain a current maximum value. Rotate two lines at the same time until one of them coincides with one edge of the polygon. A new pair of heel points is produced at this time. Calculates the new distance, and compares it with the current maximum, which is newer than the current maximum value. Repeat steps 3 and 4 until the heel pair (Ymin,ymax) is produced again. The output determines the heel point pair for the maximum diameter. At this point, the above procedure (in pseudocode) is very useful, and we can get other information, such as the width of the polygon, from the pair of heel points.
Original address: http://cgm.cs.mcgill.ca/~orm/diam.html
Rotation jam-the width of the convex polygon the width of the convex polygon is defined as the minimum distance between parallel tangents. This definition has been slightly reflected in the word width. Although the tangent of a convex polygon has a different orientation, the width (usually) is different in each direction. But fortunately, not every direction must be detected.
We assume that there is a line segment [A, a], and two lines through a and b . By rotating these two lines around these two points, the distance between them increases or decreases. In particular, there is always a specific direction of rotation makes the distance between two lines smaller by rotation.
This simple conclusion can be applied to the problem of width: not all directions need to be considered. Suppose a polygon is given, and there are two parallel tangent lines. If they are not coincident with the edge, then we can always rotate to reduce the distance between them. Therefore, two parallel tangents may determine the width of a polygon only if at least one of them is coincident with the edge.
This means that the pair heel point-edge and edge-edge pairs need to be considered during the calculation of the width.
A schematic diagram of the width of a convex polygon. The diameter is shown by a black point that is crossed by a parallel tangent (red line) in the figure. The diameter is as shown in the highlighted light blue line.
An algorithm that is very similar to the calculation of the diameter problem can be obtained by traversing the polygon to the heel point pair list, determining the vertex-edge and edge-edge pair to calculate the width. The selection process is as follows: Calculates the endpoint in the Y direction of the polygon. We call it ymin and Ymax. Construct two horizontal tangents through ymin and Ymax. If a (or two) line coincides with the edge, then a "pair heel point-edge" pair or "edge-edge" pair has been established. At this point, the distance between the two lines is calculated and saved as the current minimum distance. Rotate two lines at the same time until one of them coincides with one edge of the polygon. A new pair of heel point-edge pairs (or when both lines coincide with edges, edge-edge pairs) are generated at this time. Calculates the new distance, and compares it with the current minimum value, which is less than the current minimum. Repeat steps 3 and 4 (jam) until you reach the position of the original parallel edge again. The pair that will get the minimum value as the pair output to determine the width.
The more intuitive algorithm is again due to the need to introduce the calculation of the angle to reflect its shortcomings. However, as in the case of the maximum distance between convex polygons, sometimes the simpler and more intuitive rotation jam algorithm must be introduced into the calculation.
Original address: http://cgm.cs.mcgill.ca/~orm/width.html
rotating Jam-the minimum distance between convex polygons minimum distance between convex polygonsGiven two non-connected (such as disjoint) convex polygons p and Q, the goal is to find the point pair (p, q) with the minimum distance (p belongs to p and Q belongs to Q).
In fact, polygon non-joins are important because what we call polygons contains their interiors. If polygons intersect, then the minimum distance becomes meaningless. Another version of this problem, however, has a solution to the minimum distance between the vertices of a convex polygon for intersecting and non-intersecting situations.
Back to our main question: Intuitively, a point that determines the minimum distance cannot be contained within a polygon. Similar to the maximum distance problem, we have the following conclusions:
The minimum distance between the two convex polygons P and Q is established by the pair heel point pair between the polygons. There is a pair of heel points between three polygons between convex polygons, so there are three possible minimum distance patterns: The case of vertex-edge in the case of vertex-vertex, "Edge-edge" case
In other words, a point pair that determines the minimum distance must not necessarily be a vertex. The following three illustrations illustrate the above conclusions:
Given the result, an algorithm based on rotational jam naturally arises:
Considering the following algorithm, the input of the algorithm is two convex polygons P and Q, respectively with M and n clockwise given vertices. Calculates the vertex with the lowest y-coordinate value on P (called YMINP) and the highest y-coordinate value on Q (called YMAXQ). Construct two tangent LP and LQ for polygons at YMINP and YMAXQ so that their corresponding polygons are on their right. At this time the LP and LQ have different orientations, and YMINP and Ymaxq become a pair of heel points between the polygons. Calculates the distance (YMINP,YMAXQ) and maintains it as the current minimum value. Rotate parallel lines clockwise until one is coincident with the edge of the polygon on which it is located. If there is only one line coincident with the edge, then only the vertex-edge pair heel point pair and the vertex-vertex pair heel point pairs distance are computed. Compare them to the current minimum value and replace the update if it is less than the current minimum value. If the two tangents are coincident with the edges, then the situation becomes more complicated. If the edges overlap, that is, you can construct a crossover that intersects two edges (but not at the vertices), the edge-edge distance is computed. Otherwise, three new vertex-vertex pairs are calculated for the heel point pair distance. All of these distances are compared to the current minimum value, and the replacement is updated if it is less than the current minimum value. Repeat steps 4 and 5 until the new point pair is (YMINP,YMAXQ). Output maximum distance. The rotational jam mode ensures that all pairs of heel points (and all possible sub-conditions) are taken into account. In addition, the entire algorithm has the current time complexity, because (except for the initialization), only the number of steps with the same order of vertices is required to execute.
The problem of minimum distance and maximum distance indicates that the rotational jam model can be used under different conditions (compared with previous diameter and width problems). This model can be applied to the problem of two polygons.
The "Smallest box" problem (minimum area bounding rectangle) shows the application of rotating jam under another condition by using two orthogonal tangent sets on the same polygon.
Original address: http://cgm.cs.mcgill.ca/~orm/mind2p.html
6, rotating jam-the maximum distance between convex polygons maximum distance between convex polygons
Given two convex polygons p and Q, the goal is to find the point pair (p,q) (P belongs to p and Q belongs to Q) to make the distance between them maximum.
Intuitively, these points cannot belong to the interior of their respective polygons. This condition is actually very similar to the diameter problem:
The maximum distance between the P and Q between two convex polygons is determined by the pair heel points between the polygons.
Although the same is true, this definition differs from the pair of heel points for a given convex polygon.
The difference between the heel point and the convex polygon is essentially that the tangent is forward and reversed. The following illustration shows an example:
The above conclusions imply that not only vertex pairs need to be detected, but only specific vertex pairs need to be taken into account. In fact, they only detect a parallel tangent that is established by an algorithm based on the rotational jam pattern.
Considering the following algorithm, the input of the algorithm is two convex polygons P and Q, respectively with M and n clockwise given vertices. Calculates the vertex with the lowest y-coordinate value on P (called YMINP) and the highest y-coordinate value on Q (called YMAXQ). Construct two tangent LP and LQ for polygons at YMINP and YMAXQ so that their corresponding polygons are on their right. At this time the LP and LQ have different orientations, and YMINP and Ymaxq become a pair of heel points between the polygons. Calculates the distance (YMINP,YMAXQ) and maintains it as the current maximum value. Rotate parallel lines clockwise until one is coincident with the edge of the polygon on which it is located. A new pair of heel points has been created. Calculates the new distance, compared to the current maximum, and updates if it is greater than the current maximum value. If two lines coincide simultaneously with the edge, a total of three pairs of heel points (the combination of the previous vertex and the new vertex) need to be taken into account. Repeat steps 4 and 5 until the new point pair is (YMINP,YMAXQ). Output maximum distance.
The rotational jam mode ensures that all pairs of heel points are considered. In addition, the entire algorithm has linear time complexity because (in addition to initialization), the number of steps executed is the same as the number of vertices.
Similar algorithms can be used in the minimum distance between convex polygons.
Original address: http://cgm.cs.mcgill.ca/~orm/maxd2p.html
7, rotating jam-convex polygon minimum area external rectangle Convex polygon Minimum area external rectangle
Given a convex polygon p, what is the smallest area of the rectangle that can be loaded with P (on the periphery)? Technically, given a direction, the end of P can be calculated and the resulting rectangle is constructed. But we need to test each case to get each rectangle to calculate the minimum area. Thankfully, we don't have to do that.
For an external rectangle of polygon P There is an edge collinear with the original polygon.
These conclusions strongly limit the possible range of rectangles. Not only do we not have to detect all possible orientations, but we only need to detect rectangles that are equal to the number of polygon edges.
The above conclusion: four tangents (red), one of which is coincident with one edge of the polygon, determines the bounding rectangle (blue).
A simple algorithm is to calculate each edge in turn as an edge coincident with the rectangle. But this method of constructing a rectangle involves computing the end point of each edge of the polygon, a calculation that takes O (n) time (because there are n edges). The entire algorithm will have two times complexity of time.
A more efficient algorithm has been found. With rotational jams, we can update in real time in constant time instead of recalculating the endpoint.
In fact, consider a convex polygon that has two pairs tangent to the four endpoints in the X and y directions. Four lines have determined the bounding rectangle of a polygon. But unless the polygon has a horizontal or vertical edge, the area of the rectangle cannot be counted into the smallest area.
However, the line can be rotated until the condition is met. This process is the core of the subordinate algorithm. Suppose you enter n vertices of a convex polygon in a clockwise order.
Calculates the endpoints of all four polygons, called Xminp, Xmaxp, YMINP, Ymaxp. Four tangents of P are constructed from four points. They identified two "jam" sets. If a (or two) line is coincident with an edge, the area of the rectangle determined by the four lines is calculated and saved as the current minimum. Otherwise, the current minimum value is defined as infinity. Rotate the line clockwise until one of the edges coincides with one edge of the polygon. Calculates the area of the new rectangle and compares it to the current minimum value. If it is less than the current minimum value, it is updated and holds the rectangle information that determines the minimum value.
Repeat steps 4 and 5 until the line is rotated over an angle greater than 90 degrees. The minimum area of the output bounding rectangle.
Because the two pairs of "jam" determine an external rectangle, the algorithm takes into account all the rectangles that may be calculating the minimum area. Further, in addition to the initial values, the main loop of the algorithm requires only the total number of vertices to be executed multiple times. Therefore, the algorithm is linear time complexity.
A similar but lesser known problem is the minimum perimeter bounding rectangle problem. Interestingly, the two problems are completely different because there are (albeit rarely) minimal area of the bounding rectangle and the minimum perimeter of the bounding rectangle polygons that do not overlap.
Original address: http://cgm.cs.mcgill.ca/~orm/maer.html
8, rotating jam-convex polygon minimum perimeter external rectangle Convex polygon Minimum perimeter bounding rectangle
This problem is similar to the minimum area bounding rectangle. Our goal is to find a minimum box (in terms of perimeter) of the external polygon P.
Interestingly, the bounding rectangle of the minimum area and minimum perimeter is usually coincident. Some people can't help but wonder whether this is always set up. The following example answers the question: The Polygon (gray) and its smallest area of the bounding rectangle (left) and the minimum perimeter bounding rectangle (right).
Now, given a direction, we can figure out the endpoint of P to determine an external rectangle. However, as with the area problem, because of the following conclusions, we do not have to detect each state to obtain a rectangle with the smallest perimeter:
The minimum perimeter of a convex polygon P has an external rectangle with an edge coincident with one edge of the polygon.
This conclusion effectively limits the possible extent of the rectangle by enumerating a coincident edge of the polygon.
The above conclusion: four tangent lines (red), one of which coincides with the polygon edge, determines the bounding rectangle (blue).
Because of its area problem, this problem can be solved by a similar algorithm based on rotational jam.
The input of the subordinate algorithm is the n vertex of a convex polygon given in clockwise order.
Calculates the endpoints of all four polygons, called Xminp, Xmaxp, YMINP, Ymaxp. Four tangents of P are constructed from four points. They identified two "jam" sets. If a (or two) line is coincident with an edge, the area of the rectangle determined by the four lines is calculated and saved as the current minimum. Otherwise, the current minimum value is defined as infinity. Rotate the line clockwise until one of the edges coincides with one edge of the polygon. Calculates the perimeter of the new rectangle and compares it to the current minimum value. If it is less than the current minimum value, it is updated and holds the rectangle information that determines the minimum value.
Repeat steps 4 and 5 until the line is rotated over an angle greater than 90 degrees. The minimum perimeter of the output bounding rectangle.
Because the two pairs of "jam" determine an external rectangle, the algorithm takes into account all the rectangles that may be calculating the minimum perimeter. Further, in addition to the initial values, the main loop of the algorithm requires only the total number of vertices to be executed multiple times. Therefore, the algorithm is linear time complexity.
Problem handling also includes triangles. There are two special cases, see onion triangulation and spiral triangulation.
Original address: http://cgm.cs.mcgill.ca/~orm/mper.html
9, rotating jam-spiral triangulation Helical Triangulation
The spiral triangulation of the point set is a triangulation diagram based on the set spiral convex hull.
Convex spirals can be constructed by starting with a specific endpoint (such as the smallest point in a given direction), where the smallest x-coordinate point is taken. Construct a plumb line by that point. Rotates the line in a given direction (always clockwise or counterclockwise) until the line "strikes" the other vertex. Connect two points with one line segment. Repeat steps 3 and 4, but always ignore the points that have been hit.
In general, this process is similar to calculating the convex hull's volume wrapping algorithm, but the difference is that its loops never stop. For a set of points with H points on a convex hull, there are 2h convex spirals: There are two clockwise and counterclockwise spirals for each starting point.
A point set (left), and its clockwise convex helix, with the smallest x-coordinate point as the initial point.
Interestingly, the convex helix and onion skins of a point set can be converted to each other in linear time. Further, similar to the onion triangulation, we can define a sub-graph of a point set as a spiral triangulation of a convex helix.
The algorithm for constructing spiral triangulation is more complex, although it is based on torus triangulation, because the helix must be segmented into a suitable convex chain. Suppose the input is a clockwise convex helix c of a point set with C = {P1, ..., pn}. Inserts the edges of the convex helix as edges of the triangulation. Starting from P1, look for the last point ph on the convex helix of the point set. Extends the last edge on the convex helix [P (n-1), PN] until it intersects the convex helix. Mark the intersection of Q '. Constructs a tangent to C tangent to point Q '. Rotate the line counterclockwise until he intersects with C at one o'clock Q and parallel to [P (n-1), PN]. Insert [P (n-1), Q] into the triangulation. After this operation, the convex helix chain is divided into two parts: the part outside the chain and the polygon area within the chain. Set Co = {P1, ..., q} and Ci = {ph, ...., q, ..., PN}. This construction process is shown in the following diagram:
Upper left corner: construction process. Upper-right corner: The polygon area outside and inside the spiral. Bottom: external and internal convex chain Co and CI.
The outer helix area can be triangulated like a torus. Co and Ci can now be viewed as a nested convex hull. The inner polygon area can be easily divided into a triangular subdivision at the star type of PN. The combination of these two triangular sections forms the structure of the entire spiral triangulation.
An example of a helical convex hull and its triangulation are as follows:
The above algorithm is linear time complexity, and the time of the algorithm depends on the running time of the torus partition.
Original address: http://cgm.cs.mcgill.ca/~orm/sptri.html
10, rotating jam--onion triangle Split Onion triangle Split
Given a set of points on a plane, the goal is to construct a triangulation of a point set.
From the Lennes 1911 two time complexity source algorithm to Chazelle 1991 linear time Complexity algorithm, the predecessors have done a lot of research on improving the efficiency of triangulation algorithm.
The focus here is on a special triangulation, a "peel onion peel" operation based on a set of points.
Consider a set of n points on a plane S. Compute the convex hull of S, and set S ' as the set of points within the convex hull. Then calculate the convex hull of S ' and perform this operation repeatedly until there is no point left. Finally, there is a series of convex packets covering the same layer as the nest, called The onion skin set S. Thanks to the Chazelle algorithm, this structure can be implemented within the O (n log n) time operation.
A point set of onion skins. Note that in addition to convex polygons, the innermost structure may be a line segment or a single point. This diagram gives the level of information, such as which is more "deep" between points.
The area between the
two nested convex hull is called a torus. In 1986, Toussaint published a simple algorithm using rotational jam to calculate the triangulation of the torus surface. Using this method, once the onion skin is constructed, triangulation can be constructed within the current time. Further, this triangulation has two features: his sub-chart is still The onion skin, and he is a Hamilton graph, that is, the vertices of the triangulation chart can be chain-like.
The triangulation algorithm for a torus is very simple. The algorithm enters a convex hull that is q P wrapped, and their vertices are in the clockwise order. Inserts the edge of the convex hull as an edge of the triangulation. The points that calculate the x coordinates of P and Q , respectively, are called xmin (P) and xmin (Q) . Two plumb tangents are constructed at xmin (P) and xmin (Q) called LP and LQ . Inserts (Xmin (P), xmin (Q)) as an edge of triangulation. The p and q points for the current LP and LQ are xmin (p) and xmin (q) respectively. Rotates the line clockwise until one is coincident with an edge. A new vertex is then "struck" by a line. If he belongs to P (called p '), insert (P ', q) into triangulation. Updates the current point to p ' and p ' . If he belongs to Q (called Q '), insert (P, Q ') into the triangulation. Updates the current point to p and q ' . For parallel edges, the two tangents coincide with the edges, and two new vertices are "struck" (called them p ' and q '). Then insert (P ', q '), and (P, q ') and (P ', q) into the triangulation. Updates the current point to P ' and q ' . Repeat the above steps until you reach the minimum point of the start.
The triangulation of a face change is as follows:
The algorithm above has linear time complexity. When triangulation of a point set, a convex hull traverses (up to) two times throughout the process, with the innermost and the most external convex hull performing only one traversal at a time. Therefore, the total elapsed time for triangulation of an n point is O (n).
Another problem that is effective and related to triangulation is the helical triangulation of the convex helix based on the point set.
Original address: http://cgm.cs.mcgill.ca/~orm/ontri.html
11, rotating jam-quadrilateral split Quadrilateral Split
Although triangulation is a more common structure, the recent quadrilateral splits are more applicable under certain conditions, such as scattered data interpolation and finite element method.
A quadrilateral subdivision is actually a quadrilateral partition of a point set. Some of the differences that are intrinsically different from triangulation (except particularly obvious) should be noted:
First, not all of the point sets have quadrilateral splits. Fact