I. Related theories
Measuring the polar coordinates of the paper is my postgraduate study stage, write the second text without the source of foreign literature, young ignorance, see the literature is not fully understand, began to write code, and then through the code constantly according to the literature algorithm, to adjust, and finally the paper code to achieve. This paper algorithm in detail to provide for the hard work of three-dimensional graphics algorithm of the fellow human learning.
Three-dimensional algorithm is more difficult, online data is relatively small, in addition to the net, Wanfang and other databases can have literature to see, the code can say no, foreign to find to improve the source of the paper is not easy, so to the three-dimensional cagd some algorithms to understand is not easy, This memorial once walked through the three-dimensional pain-forced algorithm to learn the road. This blog is mainly to explain the literature: "Geodesic polar coordinates on polygonal", here in Chinese I translated it as: Measuring the polar coordinates parameterization, the discrete power mapping algorithm in each vertex parameter value depends on the vertex of the normal vector, Therefore, when the mesh curvature changes greatly, the parametric results are often distorted greatly. Compared with the discrete exponential mapping algorithm, the method of measuring polar coordinates based on Eivind has better stability and robustness.
Given a triangular mesh model with n vertices m= (v,e,t), V is a vertex set, E is an edge set, T is a triangular patch set. Set TIJK=[VI,VJ,VK], set S to any point on the mesh surface, tangent vector x as the base direction, as shown.
Second, the algorithm explained
On the grid surface, for a given parameterized seed point s, we divide the vertices on the mesh surface into two categories: 1-ring, K-ring (k>=2), where 1-ring represents the vertices directly connected to s, and k-ring represents the vertices that are not adjacent to S. For the method of measuring polar coordinates parameterization, we need to use different calculation formulae according to these two vertices.
1.1-ring Parameterization method
For any point s on the mesh surface, the position of the triangular surface of the mesh according to the S point can be divided into three kinds of triangle surface points, edge points and vertices:
①s is the point in the T0 of the triangular plane, such as the S1 point of the graph, the polar coordinates of the T0 three vertices can be obtained by using the T0 as the parametric plane and the S point as the origin.
②s is located on the edge of the grid E0, such as the S2 point, at this point, just take the E0 as a hinge, fixed one of the plane, to E0 as a hinge, the other adjacent triangular surface to the same plane,
③s is the vertex of the mesh surface, using: The polar coordinate mapping presented in the Free-form shape design using triangulated surfaces: that is to ensure that the length of the adjacent edges of s-points is constant, the scaling ratio of the adjacency angle is, and the θi is the adjacency angle of the vertex, That is, the local parametric satisfaction of the vertex adjacent to the s point:
where V and W are adjacent vertices of S point, the adjacent triangular surface of S point can be partially flattened by the formula.
2, k-ring parameterization
As shown in the figure, there are 4 points on the mesh surface, respectively, S, VI, VJ, Vk,s Point as the source, VI, VJ, VK for the same triangle surface three vertices, and vi measuring polar coordinates unknown, VJ, VK for polar coordinates known points, respectively (RJ,ΘJ), (Rk,θk), The target is to obtain the polar coordinates of VI, that is, the mapping point of VI in the parameter space TP.
The basic idea of the parametric method of measuring polar coordinates is: Taking VI ' (0,0) as the origin, the local parameterization of One Ring neighborhood of VI, then the VK ', VJ ' as the circle point, and the RK and RJ as the circle, then the intersection s ' of the two circles can be obtained. Using S ' as pseudo source point, the polar coordinates of VI are computed by the pseudo source point.
Set Ek=vk '-vi ', ej=vj '-vi ', ekj=vk '-vj ', the pseudo source point S ' can be expressed as:
S ' =xjej+xkek
Type,
,
The coordinates of S ' in the VI local parameter space can be computed according to the (8) type. This allows the VI to map to TP's Polar path:
Polar Angle Calculation formula:
Θi= (1-α) θj+αθk
In the formula, the Α=ΦIJ/ΦKJ,ΦKJ is the angle between the vector VK ' s ' and the vector VJ ' s ', Φij is the angle between the vector vi ' s ' and the vector VJ ' s '.
The method of measuring polar coordinates: firstly, the local parameterization of One Ring neighborhood of Source point is made, and then the polar diameter is used as the basis for the Dijkstra algorithm to spread out. In the process of Dijkstra algorithm diffusion, the polar coordinates of active vertices are constantly updated with formula (9) (10).
Third, the implementation of the algorithm
Here is the pseudocode in paper: [cpp] View plain copy <span style= "font-size:18px;" >Algorithm 1: Pseudo code for computing DGPC on a mesh 1: for i = 1, ,n do 2: U[i] =∞ 3: end for 4: initializeneighbourhood (s) 5: Candidates.push ( neighbourhood ( s ) ) 6: while candidates.notempty () do 7: j = candidates.getsmallestnode () 8: for i ∈ neighbours (j) do 9: newui = computedistance (i) 10: if U[i] / newUi > 1 + eps then 11: u[i] = newui 12: theta[i] = computeangle (i) 13: if newui < Umax then 14: candidaTes.push (i) 15: end if 16: end if 17: end for 18: end while</span>
Reference documents:
1, "differential coordinates for interactive mesh editing"
2, "Interactive decal compositing with discrete exponential maps"
3. "Part-based representation and editing of 3D surface models"
4, "geodesic polar coordinates on polygonal" ********************** Author: hjimce time: 2015.5.10 contact qq:1393852684 Address: HTTP://BL OG.CSDN.NET/HJIMCE original article, All rights reserved, reprint please keep the bank information ********************