本文整理汇总了C++中Manifold::build方法的典型用法代码示例。如果您正苦于以下问题:C++ Manifold::build方法的具体用法?C++ Manifold::build怎么用?C++ Manifold::build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manifold
的用法示例。
在下文中一共展示了Manifold::build方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_single_triangle_manifold
void create_single_triangle_manifold(const Vec3f& p1,
const Vec3f& p2,
const Vec3f& p3,
Manifold& mani)
{
// Create vector of vertices
vector<Vec3f> vertices(3);
vertices[0] = p1;
vertices[1] = p2;
vertices[2] = p3;
// Create vector of faces. Each element corresponds to a face and tells
// how many vertices that face contains. In the case of a triangle
// mesh, each face has three vertices.
vector<int> faces(1);
faces[0] = 3;
// Create the index vector. Each element is an index into the vertex list
//
vector<int> indices(3);
indices[0]=0;
indices[1]=1;
indices[2]=2;
mani.build(3, // Number of vertices.
reinterpret_cast<float*>(&vertices[0]),// Pointer to vertices.
1, // Number of faces.
&faces[0], // Pointer to faces.
&indices[0]);// Pointer to indices.
}
示例2: dual
void dual(Manifold& m)
{
// Create new vertices. Each face becomes a vertex whose position
// is the centre of the face
int i = 0;
FaceAttributeVector<int> ftouched;
vector<Vec3d> vertices;
vertices.resize(m.no_faces());
for(auto f : m.faces())
vertices[ftouched[f] = i++] = centre(m, f);
// Create new faces. Each vertex is a new face with N=valency of vertex
// edges.
vector<int> faces;
vector<int> indices;
for(auto v : m.vertices())
if(valency(m, v) > 2 && !(boundary(m, v)))
{
// int N = circulate_vertex_ccw(m, v, (std::function<void(FaceID)>)[&](FaceID fid) {
// indices.push_back(ftouched[fid]);
// });
Walker w = m.walker(v);
for(; !w.full_circle(); w = w.circulate_vertex_ccw()){
indices.push_back(ftouched[w.face()]);
}
int N = w.no_steps();
// Insert face valency in the face vector.
faces.push_back(N);
}
// Clear the manifold before new geometry is inserted.
m.clear();
// And build
m.build( vertices.size(),
reinterpret_cast<double*>(&vertices[0]),
faces.size(),
&faces[0],
&indices[0]);
}
示例3: max
bool x3d_load(const string& filename, Manifold& m)
{
faces.clear();
indices.clear();
vertices.clear();
Timer tim;
tim.start();
string baseurl;
int idx = max(find_last_of(filename, "\\"),
find_last_of(filename, "/"));
if(idx != -1)
baseurl = string(filename.substr(0, idx+1));
XmlDoc x3d_doc(filename.c_str());
if(!x3d_doc.is_valid())
return false;
x3d_doc.add_handler("Shape", handle_Shape);
x3d_doc.add_handler("IndexedFaceSet", handle_IndexedFaceSet);
x3d_doc.add_handler("Coordinate", handle_Coordinate);
x3d_doc.process_elements();
x3d_doc.close();
cout << "vertices " << vertices.size() << endl;
m.build(vertices.size()/3,
reinterpret_cast<float*>(&vertices[0]),
faces.size(),
&faces[0],
&indices[0]);
cout << " Loading took " << tim.get_secs() << endl;
return true;
}