The goal is to select a vertex of a existing polygon in the painting area. The selected vertex will be the input for the following 3-coloring process.
It will be easy and efficient to search for something in an ordered data structure, the binary search tree for example. A polygon's vertices can be stored in a 2D-Tree. One can find a nearest vertex around the cursor by searching the nearest children with respect to cursor position in the 2D-Tree.
The goal is to select a vertex of a existing polygon in the painting area. The selected vertex will be the input for the following 3-coloring process.
It will be easy and efficient to search for something in an ordered data structure, the binary search tree for example. A polygon's vertices can be stored in a 2D-Tree. One can find a nearest vertex around the cursor by searching the nearest children with respect to cursor position in the 2D-Tree.
Available implement of KD-tree: