Algorithm: CalculateInternalNodeCoordinate(Surf, Pln)

Description: Calculating the coordinates of internal vertexes in a planar pattern region

Input: Surf//collection of surface facets

Pln//collection of planar facets

Output: Pln

1 Create matrix A and B which are used for sparse matrix equation AX = B

2 FOR each Pnt3d_i which is vertex in Surf DO

3 get index_i which is index of Pnt3d_i in Surf

4 IF Pnt3d_i is on the boundary THEN

5 add (index_i, 1.0) to A

6 get Pnt2d_Bnd_i which is vertex in Pln by index_i

7 add Pnt2d_Bnd_i to B


9 get Vec_Pnt3d_i which stores adjacent vertexes of Pnt3d_i and Vec_index_i which stores related indexes of Vec_Pnt3d_i

10 create Total_Angle_i, Vec_Length_i and Vec_Angle_i for flattened adjacent vertexes

11 FOR each j DO

12 calculate Angle_j which is angle of three vertexes which are Vec_Pnt3d_i(j), Pnt3d_i and Vec_Pnt3d_i(j+1)

13 add Angle_j to Vec_Angle_i

14 Total_Angle_i += Angle_j

15 calculate Length_j which is length between Vec_Pnt3d_i(j) and Pnt3d_i

16 add Length_j to Vec_Length


17 FOR each j DO

18 Vec_Angle_i(j) = Vec_Angle_i(j) / Total_Angle_i * 2 * Pi

19 calculate Vec_Pnt2d_i which stores coordinates of flattened adjacent vertexes by Vec_Length_i and Vec_Angle_i

20 calculate f_i which is linear combination relationship between Pnt2d_i which is related to Pnt3d_i and Vec_Pnt2d_i by Pnt2d_i, index_i, Vec_Pnt2d_i and Vec_Pnt3d_i

21 add f_i to A and B

22 calculate Vec_Pnt2d which stores coordinates of nodes in a planar pattern region by solving the sparse matrix equation AX = B



23 FOR each i DO

24 IF Vec_Pnt2d(i) is not on the boundary THEN add (i, Vec_Pnt2d(i)) to Pln