私はこの小さな問題に悩まされており、これを解決するためのアルゴリズムはすべてのケースに当てはまるわけではありません。これを解決する方法を知っている人はいますか?
ポリゴンの例を次に示します。
例 http://img148.imageshack.us/img148/8804/poly.png
正式な説明
多角形を定義する CW 順の点のリストがあります。ポイントが切断ポイントであるかどうかをクエリすることもできます。is_cut(p)
ここp
で、 は特定のポイントです。次に、この「カット」によって生じる新しいポリゴンを計算します。
アルゴリズムはこれを行う必要があります。
入力:{a, c1, b, c4, c, c5, d, c6, e, c3, f, c2}
出力: {a, c1, c2}
, {b, c4, c3, f, c2, c1}
, {d, c6, c5}
,{e, c3, c4, c, c5, c6}
ここに私の現在のアルゴリズム:
follow your points, CW
if the point is a cut point
-> go back trough the list looking for cut points
--- if next cut point is connected to the current cut point
and not part of the current poly, follow it
--- else keep searching
else
-> continue until you hit your starting point.
that's a poly
do this for every non-cut-point
c
またはで開始した場合、このアルゴリズムは成立しませんf
。