# Least-Squares Estimation of Tangent Space for a Triangular Mesh
## 3 Method
### Incorporation of Texture Space Alignment  
Now, \(\bar{\mathbf{R}}_{ij}\) can be incorporated into Equations (7)-(11). For example, Equation (8) is adapted to obtain the rotation matrix, \(\mathbf{R}_{i}\), as follows:  
\[\mathbf{A}_{i}=\sum_{j=1}^{n}\sum_{k\in\mathcal{N}_{ij}}w_{ik}(\mathbf{p}_{k}- \mathbf{p}_{i})\Big{[}\bar{\mathbf{R}}_{ij}(\bar{\mathbf{p}}_{k}-\bar{\mathbf{ p}}_{ij})\Big{]}^{\mathrm{T}}=\mathbf{R}_{i}\mathbf{S}_{i} \tag{14}\]  
where \(\mathbf{A}_{i_{1}}=\mathbf{A}_{i}\), \(w_{ijk}=w_{ik}\), and \(\mathbf{p}_{ij}=\mathbf{p}_{i}\) were employed. When vertex \(i\) has no duplicates, Equation (14) becomes exactly the same as Equation (8) because \(\bar{\mathbf{R}}_{i_{1}}=\mathbf{I}\).  
\(\mathbf{A}_{ij}\) for \(j\in[2,n]\) need not be computed from scratch to obtain \(\mathbf{R}_{ij}\). Instead, we can directly obtain \(\mathbf{R}_{ij}\) from \(\mathbf{R}_{i}\) by  
\[\mathbf{R}_{ij}=\mathbf{R}_{i}\bar{\mathbf{R}}_{ij}. \tag{15}\]  
This simplification arises because the triangles sharing vertex \(i_{j}\) undergo \(\bar{\mathbf{R}}_{ij}\) in texture space to optimally align their two seam edges with the matching edges. Subsequently, all vertices of the triangles sharing the duplicates undergo \(\mathbf{R}_{i}\) for optimal matching with their corresponding vertices in world space. Equation (15) highlights that each duplicate has a distinct tangent space, differing from the tangent spaces of other duplicates by the amount of the differences in optimal alignment in texture space, as illustrated in Figure 2c.  
Figure 5: Optimal alignment for seam edges. The triangles adjacent to the duplicated vertices are optimally aligned in texture space before computing the tangent space. (**a**) Texture space; (**b**) Aligned in texture space; (**c**) World space.  
Equation (15) can also be derived algebraically. To compute \(\mathbf{A}_{i_{j}}\) as in Equation (14), for a certain vertex \(i_{l}\), we need to rewrite the rotation matrix, \(\mathbf{R}_{i_{j}}\), with respect to vertex \(i_{l}\), resulting in \(\mathbf{R}_{i_{l}}^{\mathrm{T}}\mathbf{R}_{i_{j}}\). Then, the covariance matrix is written as  
\[\mathbf{A}_{i_{l}}=\sum_{j=1}^{n}\sum_{k\in\mathcal{N}_{i_{j}}}w_{ik}(\mathbf{ p}_{k}-\mathbf{p}_{i_{l}})\Big{[}\bar{\mathbf{R}}_{i_{l}}^{\mathrm{T}}\bar{ \mathbf{R}}_{i_{j}}(\bar{\mathbf{p}}_{k}-\bar{\mathbf{p}}_{i_{l}})\Big{]}^{ \mathrm{T}}=\mathbf{A}_{i}\bar{\mathbf{R}}_{i_{l}}. \tag{16}\]  
Utilizing \(\mathbf{A}_{i}=\mathbf{R}_{i}\mathbf{S}_{i}\) given in Equation (14), we obtain  
\[\mathbf{A}_{i_{l}}=\mathbf{R}_{i}\mathbf{S}_{i}\bar{\mathbf{R}}_{i_{j}}= \mathbf{R}_{i}\big{(}\bar{\mathbf{R}}_{i_{l}}\bar{\mathbf{R}}_{i_{l}}^{ \mathrm{T}}\big{)}\mathbf{S}_{i}\bar{\mathbf{R}}_{i_{l}}=\big{(}\mathbf{R}_{i }\bar{\mathbf{R}}_{i_{l}}\big{)}\big{(}\bar{\mathbf{R}}_{i_{l}}^{\mathrm{T}} \mathbf{S}_{i}\bar{\mathbf{R}}_{i_{l}}\big{)}=\mathbf{R}_{i}\mathbf{S}_{i_{l}}. \tag{17}\]  
From this result, we observe that \(\mathbf{R}_{i_{l}}=\mathbf{R}_{i}\bar{\mathbf{R}}_{i_{l}}\). Replacing index \(l\) with \(j\) gives the tangent space of vertex \(i_{j}\), \(\mathbf{R}_{i_{j}}=\mathbf{R}_{i}\bar{\mathbf{R}}_{i_{j}}\), which matches the formula given in Equation (15).