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

Function extract_vertices

tools/Compression/Draco/DracoCompressionEngine.cpp:171–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169
170template<typename DracoMesh>
171VectorF extract_vertices(std::unique_ptr<DracoMesh>& draco_mesh, size_t& dim) {
172 const auto num_vertices = draco_mesh->num_points();
173 const auto positions = draco_mesh->GetNamedAttribute(
174 draco::GeometryAttribute::POSITION);
175 assert(positions->IsValid());
176 dim = positions->num_components();
177
178 VectorF vertices(num_vertices * dim);
179 if (dim == 2) {
180 for (size_t i=0; i<num_vertices; i++) {
181 const auto p = positions->template GetValue<Float, 2>(
182 draco::AttributeValueIndex(i));
183 vertices(i*2 ) = p[0];
184 vertices(i*2+1) = p[1];
185 }
186 } else if (dim == 3) {
187 for (size_t i=0; i<num_vertices; i++) {
188 const auto p = positions->template GetValue<Float, 3>(
189 draco::AttributeValueIndex(i));
190 vertices(i*3 ) = p[0];
191 vertices(i*3+1) = p[1];
192 vertices(i*3+2) = p[2];
193 }
194 } else {
195 throw NotImplementedError("Draco mesh encodes high dimensional data");
196 }
197 return vertices;
198}
199
200template<typename DracoMesh>
201VectorI extract_faces(std::unique_ptr<DracoMesh>& draco_mesh) {

Callers 15

from_draco_meshFunction · 0.85
from_draco_point_cloudFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
TEST_FFunction · 0.85
get_disjoint_settingMethod · 0.85
get_overlap_settingMethod · 0.85
TEST_FFunction · 0.85

Calls 2

NotImplementedErrorClass · 0.85
num_componentsMethod · 0.80

Tested by 15

TEST_FFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
TEST_FFunction · 0.68
get_disjoint_settingMethod · 0.68
get_overlap_settingMethod · 0.68
TEST_FFunction · 0.68
get_disjoint_settingMethod · 0.68
get_overlap_settingMethod · 0.68
TEST_FFunction · 0.68