MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / is_periodic

Method is_periodic

tests/tools/Wires/Inflator/MeshValidation.cpp:72–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72bool MeshValidation::is_periodic(
73 const MatrixFr& vertices, const MatrixIr& faces) {
74 const Float EPS = 1e-6;
75 HashGrid::Ptr grid = compute_vertex_grid(vertices, EPS);
76
77 Vector3F bbox_min = vertices.colwise().minCoeff();
78 Vector3F bbox_max = vertices.colwise().maxCoeff();
79 Vector3F bbox_size = bbox_max - bbox_min;
80
81 Vector3F offsets[] = {
82 Vector3F( bbox_size[0], 0.0, 0.0),
83 Vector3F(-bbox_size[0], 0.0, 0.0),
84 Vector3F(0.0, bbox_size[1], 0.0),
85 Vector3F(0.0,-bbox_size[1], 0.0),
86 Vector3F(0.0, 0.0, bbox_size[2]),
87 Vector3F(0.0, 0.0,-bbox_size[2])
88 };
89
90 bool result = true;
91 const size_t num_vertices = vertices.rows();
92 for (size_t i=0; i<num_vertices; i++) {
93 const VectorF& v = vertices.row(i);
94 if (fabs(v[0] - bbox_min[0]) < EPS) {
95 result = result && match(grid, v + offsets[0]);
96 }
97 if (fabs(v[0] - bbox_max[0]) < EPS) {
98 result = result && match(grid, v + offsets[1]);
99 }
100 if (fabs(v[1] - bbox_min[1]) < EPS) {
101 result = result && match(grid, v + offsets[2]);
102 }
103 if (fabs(v[1] - bbox_max[1]) < EPS) {
104 result = result && match(grid, v + offsets[3]);
105 }
106 if (fabs(v[2] - bbox_min[2]) < EPS) {
107 result = result && match(grid, v + offsets[4]);
108 }
109 if (fabs(v[2] - bbox_max[2]) < EPS) {
110 result = result && match(grid, v + offsets[5]);
111 }
112 }
113 return result;
114}
115
116bool MeshValidation::face_source_is_valid(
117 const MatrixFr& vertices,

Callers

nothing calls this directly

Calls 2

compute_vertex_gridFunction · 0.85
matchFunction · 0.85

Tested by

no test coverage detected