ShampooDeng / triangulate-rs-egui

Triangulation algorithm for simple polygon with GUI, a project for my computational geometry course.
Apache License 2.0
1 stars 1 forks source link

Select a polygon's vertex with a mouse click #1

Closed ShampooDeng closed 4 months ago

ShampooDeng commented 4 months ago

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:

ShampooDeng commented 4 months ago

Complete with 52842fb9ad653c7e1852ad9c4507ddc08f607269