Skip to content

Code for paper "P2M: A Fast Solver for Querying Distance from Point to Mesh Surface". ACM TOG (SIGGRAPH 2023).

License

Notifications You must be signed in to change notification settings

Martin-JC-Xu/P2M

Repository files navigation

P2M: A Fast Solver for Querying Distance from Point to Mesh Surface

This repository is the official code release for the paper "P2M: A Fast Solver for Querying Distance from Point to Mesh Surface". This paper is published in ACM Transactions on Graphics (SIGGRAPH 2023).

Paper link: https://arxiv.org/abs/2308.16084

Doi: https://dl.acm.org/doi/10.1145/3592439

Dependencies

Example

Here is an example. The code is tested on Windows 11 with Visual Studio 2019.

#include "Model.h"

// specify the positions of the points
vector<Eigen::Vector3d> points;  

// specify the indexes of endpoints, leave this vector empty if there are no segments
vector<pair<int, int>> segments;   

// specify the indexes of vertices
vector<Eigen::Vector3i> faces;

// see the note below for details
double limit_cube_len = 1e3;

// construction
Model m(points, segments, faces, limit_cube_len);

// perform a closest point query
P2M_Result res;
Eigen::Vector3d query_point;
m.p2m(query_point, res);

Note: limit_cube_len is a limit value used in Voronoi diagram construction. Just ensure that the absolute coordinate values of mesh and query points are within limit_cube_len. If limit_cube_len is too large compared to the bounding box of the input mesh, there will be some precision problems in Delaunay tetrahedralization. If we find any degenerate tetrahedron, the program will stop and output an exception. Also, a smaller limit value will make the program slightly faster.

In P2M, the input points are part of the mesh and will be considered in distant queries even if there exist isolated points, so remove the isolated ones if you don't want them.

If you come across any problems with the code, please let me know.

Citation

@article{Zong2023P2M,
author = {Zong, Chen and Xu, Jiacheng and Song, Jiantao and Chen, Shuangmin and Xin, Shiqing and Wang, Wenping and Tu, Changhe},
title = {P2M: A Fast Solver for Querying Distance from Point to Mesh Surface},
year = {2023},
issue_date = {August 2023},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
volume = {42},
number = {4},
issn = {0730-0301},
url = {https://doi.org/10.1145/3592439},
doi = {10.1145/3592439},
journal = {ACM Transactions on Graphics (TOG)},
month = {jul},
articleno = {147},
numpages = {13},
keywords = {distance query, bounding volume hierarchy (BVH), proximity query package (PQP), KD tree (KDT), convex polytope}
}

About

Code for paper "P2M: A Fast Solver for Querying Distance from Point to Mesh Surface". ACM TOG (SIGGRAPH 2023).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published