離散ボロノイ図を作成する素朴で簡単な方法は、すべての離散点について、どの母点に最も近いかを1つ1つ計算していく方法である。この方法は、離散点の数 M (=WxH) と母点数 N に比例した時間がかかるのが欠点だが、アルゴリズムは簡単である。そこで、まず手始めに全探索法のアルゴリズムを考え、これをプログラム化して離散ボロノイ図の作成実験をしてみよう。 全探索法のアルゴリズム 全探索法のアルゴリズムを、なるべく簡単な言葉で述べると、次のようになる。 N 個の母点からなる母点集合 S と、離散ボロノイ図を作成するための離散平面を準備する。 母点集合と離散平面を初期化する。 すべての離散点について、4. の処理を繰り返して 5. へ すべての母点との距離を計算し、最も距離が小さい母点の番号を、その離散点の位置に書きこむ。 結果を出力して終了 このアルゴリズムをフローチャートの形に表すと図4.1のよ