GSharker / G-Shark

G-Shark is a free and open-source geometry library designed for computational designers and software developers in the Architecture, Engineering, and Construction (AEC) industry.
https://gsharker.github.io/G-Shark/
MIT License
215 stars 37 forks source link

Mesh closest point #420

Open Sophielelerre opened 1 year ago

Sophielelerre commented 1 year ago

What type of PR is this? (check all applicable)

Description

This PR adds a ClosestPoint() implementation for meshes. The method takes a mesh and a test point and returns the closest point to the test point on the mesh. The algorithm finds the closest point to all the faces, then the absolute closest. This point can be either on a mesh vertex, mesh edge, or inside a mesh face. The method can be used with triangle meshes, quad meshes, and Ngon meshes. Any Ngons faces are triangulated using vertices' centroid and consecutive vertices. Quads are treated as Ngons. I did not work on the tests yet, I'd like some feedback first.

Related Tickets & Documents

Please use this format link issue numbers: Fixes #416 https://github.com/GSharker/G-Shark/issues/416#issue-1736250025

Added tests?

Added to documentation?