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

Method clip_phantom_mesh

tools/Wires/Inflator/PeriodicInflator2D.cpp:110–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void PeriodicInflator2D::clip_phantom_mesh(
111 std::list<Float>& vertices, std::list<size_t>& faces,
112 std::list<int>& face_sources) {
113 VectorF bbox_min, bbox_max;
114 get_center_cell_bbox(bbox_min, bbox_max);
115 const size_t num_phantom_faces = m_phantom_faces.rows();
116 size_t base_index = m_phantom_vertices.rows();
117 for (size_t i=0; i<num_phantom_faces; i++) {
118 const int face_source = m_phantom_face_sources[i];
119 const Vector3I& face = m_phantom_faces.row(i);
120 const Vector2F& p0 = m_phantom_vertices.row(face[0]);
121 const Vector2F& p1 = m_phantom_vertices.row(face[1]);
122 const Vector2F& p2 = m_phantom_vertices.row(face[2]);
123
124 Location loc = bbox_check(bbox_min, bbox_max, p0, p1, p2);
125 if (loc == INSIDE) {
126 append(face, faces);
127 face_sources.push_back(face_source);
128 } else if (loc == ON_BORDER) {
129 MatrixFr cut_vertices;
130 MatrixIr cut_faces;
131 cut_face(bbox_min, bbox_max, p0, p1, p2,
132 cut_vertices, cut_faces);
133
134 cut_faces.array() += base_index;
135 append(cut_vertices, vertices);
136 append(cut_faces, faces);
137 const size_t num_cut_faces = cut_faces.rows();
138 for (size_t j=0; j<num_cut_faces; j++)
139 face_sources.push_back(face_source);
140 base_index += cut_vertices.rows();
141 }
142 }
143}
144
145
146

Callers

nothing calls this directly

Calls 3

bbox_checkFunction · 0.85
appendFunction · 0.85
cut_faceFunction · 0.85

Tested by

no test coverage detected