図1. この関数で行うこと。 Fig. 1. Processings done by this function. |
Npoints | 点の個数。 The number of points. |
x | 点の\(x\)座標を並べた配列。 An array composed of the \(x\)-coordinates of the points. |
y | 点の\(y\)座標を並べた配列。 An array composed of the \(y\)-coordinates of the points. |
triangles | 求めた三角形のリストの代入先。
宣言しただけのstruct triangle ∗型変数に&を付けて与える。
関数内で配列の動的メモリの確保が行われ、
\(i\)番目の三角形要素の情報がtriangles[i]に代入される。
なお、構造体のメンバip1, ip2, ip3, p1, p2, p3のみが設定される。
三角形の3つの頂点はip1<ip2<ip3となるように並べられる。 Memory into which the list of triangles is to be inserted. Give an empty struct triangle ∗-type variable with &. Within the function, an array is allocated, and the array components triangles[i] for each \(i\) are set as representing the \(i\)th triangle. Only the members ip1, ip2, ip3, p1, p2, and p3 of the structure are set. The three vertexes of each triangle are sorted as ip1 < ip2 < ip3. |
Npoints_extended | 外周を含めた点の個数の代入先。
元々の点(図1の黒丸)に加え、
外周に追加した三角形(図1bの赤)の頂点もカウントに含める。
宣言しただけのint型変数に&を付けて与える。 Memory into which the number of points is to be inserted, where both the original points (black dots in Fig. 1) and the vertexes of triangles added outside (red in Fig. 1b) are taken into account. Give an empty int-type variable with &. |
x_extended | 外周を含めた点の\(x\)座標のリストの代入先。
元々の点(図1の黒丸)に加え、
外周に追加した三角形(図1bの赤)の頂点もリストに含める。
最初に元々の点を引数\(x\)と同じ順番で並べ、
次に外周の長方形上の点を
南西→南東→北東→北西→南西の順に並べる。
宣言しただけのint型変数に&を付けて与える。 Memory into which a list of the \(x\)-coordinates of points is to be inserted, where both the original points (black dots in Fig. 1) and the vertexes of triangles added outside (red in Fig. 1b) are taken into account. The earlier part of this list is simply a copy of argument x, and in the later part, the points on the outer rectangle are sorted as southwest → southeast → northeast → northwest → southwest. Give an empty int-type variable with &. |
y_extended | 外周を含めた点の\(y\)座標のリストの代入先。
元々の点(図1の黒丸)に加え、
外周に追加した三角形(図1bの赤)の頂点もリストに含める。
最初に元々の点を引数\(y\)と同じ順番で並べ、
次に外周の長方形上の点を
南西→南東→北東→北西→南西の順に並べる。
宣言しただけのint型変数に&を付けて与える。 Memory into which a list of the \(y\)-coordinates of points is to be inserted, where both the original points (black dots in Fig. 1) and the vertexes of triangles added outside (red in Fig. 1b) are taken into account. The earlier part of this list is simply a copy of argument y, and in the later part, the points on the outer rectangle are sorted as southwest → southeast → northeast → northwest → southwest. Give an empty int-type variable with &. |
図2. 目標とする長方形(赤)。 Fig. 2. The target rectangle to create (red). |
図3. 領域外周に位置する辺(赤)。 Fig. 3. The edges located on the outer boundary (red). |
図4. 領域外周に位置する辺の区間による分割。 赤:南区間。緑:東区間。青:北区間。紫:西区間。 Fig. 4. Division of the edges located on the outer boundary to sections. Red, green, blue, and purple are the southern, eastern, northern, and western sections, respectively. |
図5. 南区間の点の番号付け。 Fig. 5. Renumbering of the points on the southern section. |
図6. \(x_0^s<x_1^s<x_s^2<\cdots <x_N^s\) が成り立たないケース。この場合はエラー終了する。 Fig. 6. A case where \(x_0^s<x_1^s<x_s^2<\cdots <x_N^s\) does not hold. In this case, the program finishes as an error. |
図7. 南区間の外側に作成する4種類の三角形。 Fig. 7. Four types of triangles added to the southern side. |