本文整理汇总了C++中Tr::number_of_vertices方法的典型用法代码示例。如果您正苦于以下问题:C++ Tr::number_of_vertices方法的具体用法?C++ Tr::number_of_vertices怎么用?C++ Tr::number_of_vertices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tr
的用法示例。
在下文中一共展示了Tr::number_of_vertices方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
Tr tr; // 3D-Delaunay triangulation
C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation
// defining the surface
Surface_3 surface(moebius_function, // pointer to function
Sphere_3(Point_3(0.0001, -0.0003, 0.), 2.)); // bounding sphere
// defining meshing criteria
CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30., // angular bound
0.05, // radius bound
0.05); // distance bound
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());
std::ofstream out("out.off");
#ifndef NDEBUG
const bool result =
#endif
CGAL::output_surface_facets_to_off(out, c2t3,
CGAL::Surface_mesher::IO_VERBOSE |
CGAL::Surface_mesher::IO_ORIENT_SURFACE);
assert(result == false);
std::cout << "Final number of points: " << tr.number_of_vertices() << "\n";
}
示例2: ShereMesh
void ShereMesh() {
Tr tr; // 3D-Delaunay triangulation
C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation
// defining the surface
Surface_3 surface(sphere_function, // pointer to function
Sphere_3(CGAL::ORIGIN, 2.)); // bounding sphere
// Note that "2." above is the *squared* radius of the bounding sphere!
// defining meshing criteria
CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30., // angular bound
0.1, // radius bound
0.1); // distance bound
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());
std::cout << "Final number of points: " << tr.number_of_vertices() << "\n";
//Output mesh
//Polyhedron polymesh;
//bool result = CGAL::output_surface_facets_to_polyhedron(c2t3, polymesh);
//std::cout << "output_surface_facets_to_polyhedron: " << result << "\n";
//Scommentare per salvare mesh su file
std::ofstream out("mesh_sphere_test_low.off");
CGAL::output_surface_facets_to_off (out, c2t3);
std::cout << "SAVED MESH\n";
//std::list<TriangleGT> triangleMesh;
//std::back_insert_iterator<std::list<TriangleGT> > bii(triangleMesh);
//output_surface_facets_to_triangle_soup(c2t3, bii);
}
示例3: main
int main() {
Tr tr; // 3D-Delaunay triangulation
C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation
// defining the surface
Surface_3 surface(sphere_function, // pointer to function
Sphere_3(CGAL::ORIGIN, 2.)); // bounding sphere
// Note that "2." above is the *squared* radius of the bounding sphere!
// defining meshing criteria
CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30., // angular bound
0.1, // radius bound
0.1); // distance bound
// meshing surface
CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());
std::cout << "Final number of points: " << tr.number_of_vertices() << "\n";
}
示例4: main
int main() {
Tr tr; // 3D-Delaunay triangulation
C2t3 c2t3 (tr); // 2D-complex in 3D-Delaunay triangulation
// defining the surface
std::ifstream file_input("data/triceratops.off");
Polyhedral_surface surface(file_input);
// defining meshing criteria
CGAL::Surface_mesh_default_criteria_3<Tr>
facets_criteria(30., // angular bound
0.5, // radius bound
0.5); // distance bound
CGAL::Surface_mesh_default_edges_criteria_3<Tr>
edges_criteria(0.5, // radius bound
0.5); // distance bound
// meshing surface
CGAL::make_piecewise_smooth_surface_mesh(c2t3, surface,
facets_criteria, edges_criteria,
CGAL::Manifold_tag());
std::cout << "Final number of points: " << tr.number_of_vertices() << "\n";
}
示例5: main
int main(int argc, char** argv)
{
int arg_count = 1;
bool terminal_output = true;
bool delaunay = false;
bool verbose = false;
if(argc < 2)
{
usage(argv);
return 1;
}
while(argv[arg_count][0] == '-' && std::string(argv[arg_count]) != "--")
{
if(std::string(argv[arg_count]) == "-Q")
terminal_output = false;
else if(std::string(argv[arg_count]) == "-D")
delaunay = true;
else if(std::string(argv[arg_count]) == "-v")
verbose = true;
else
{
std::cerr << "Unknown option " << argv[arg_count] << std::endl;
usage(argv);
return 1;
}
++arg_count;
}
if(std::string(argv[arg_count]) == "--")
++arg_count;
if(argc < arg_count+1 || argc > arg_count+2)
{
usage(argv);
return 1;
}
std::ifstream input(argv[arg_count]);
if(input)
{
Tr t;
CGAL::read_triangle_poly_file(t, input);
if(delaunay)
{
if(verbose)
std::cerr << "Make conforming Delaunay..." << std::endl;
CGAL::make_conforming_Delaunay_2(t);
}
else
{
if(verbose)
std::cerr << "Make conforming Gabriel..." << std::endl;
CGAL::make_conforming_Gabriel_2(t);
}
if(argc==arg_count+1)
{
if(terminal_output)
CGAL::write_triangle_poly_file(t, std::cout);
}
else
{
std::ofstream output(argv[arg_count+1]);
CGAL::write_triangle_poly_file(t, output);
}
if(terminal_output)
std::cerr
<< "Number of points: " << t.number_of_vertices() << std::endl
<< "Number of triangles: " << t.number_of_faces () << std::endl;
}
else
{
std::cerr << "Bad file: " << argv[arg_count] << std::endl;
usage(argv);
return 1;
}
return 0;
}
示例6: vtk_file
bool write_c3t3_to_vtk_xml_file(const C3t3 &c3t3, const std::string &file_name)
{
typedef typename C3t3::Triangulation Tr;
typedef typename C3t3::Cells_in_complex_iterator Cell_iterator;
typedef typename Tr::Finite_vertices_iterator Vertex_iterator;
// Domain
typedef Exact_predicates_inexact_constructions_kernel K;
typedef K::FT FT;
typedef K::Point_3 Point;
// check that file extension is "vtu"
CGAL_assertion(file_name.substr(file_name.length()-4,4) == ".vtu");
// open file
std::ofstream vtk_file(file_name.c_str());
// header
vtk_file << "<VTKFile type=\"UnstructuredGrid\" ";
vtk_file << "version=\"0.1\" ";
vtk_file << "byte_order=\"BigEndian\">" << std::endl;
int indent_size = 2;
std::string indent_unit(indent_size, ' ');
std::string indent = indent_unit;
vtk_file << indent + "<UnstructuredGrid>" << std::endl;
// write mesh
Tr t = c3t3.triangulation();
int num_vertices = t.number_of_vertices();
int num_cells = c3t3.number_of_cells_in_complex();
indent += indent_unit;
vtk_file << indent + "<Piece NumberOfPoints=\"" << num_vertices << "\" ";
vtk_file << "NumberOfCells=\"" << num_cells << "\">" << std::endl;
// Write vertices
indent += indent_unit;
vtk_file << indent + "<Points>" << std::endl;
indent += indent_unit;
vtk_file << indent;
vtk_file << "<DataArray type=\"Float32\" NumberOfComponents=\"3\" Format=\"ascii\">" << std::endl;
std::map<Point, int> V;
int i=0;
indent += indent_unit;
for (Vertex_iterator it=t.finite_vertices_begin(); it != t.finite_vertices_end(); ++it)
{
vtk_file << indent;
vtk_file << it->point().x() << " " << it->point().y() << " " << it->point().z() << std::endl;
V[it->point()] = i;
++i;
}
indent.erase(indent.length()-indent_size, indent_size);
vtk_file << indent + "</DataArray>" << std::endl;
indent.erase(indent.length()-indent_size, indent_size);
vtk_file << indent + "</Points>" << std::endl;
// Write tetrahedra
vtk_file << indent << "<Cells>" << std::endl;
indent += indent_unit;
vtk_file << indent;
vtk_file << "<DataArray type=\"Int32\" Name=\"connectivity\" Format=\"ascii\">";
vtk_file << std::endl;
indent += indent_unit;
Cell_iterator it;
for (it = c3t3.cells_in_complex_begin(); it != c3t3.cells_in_complex_end(); ++it)
{
const typename Tr::Cell c(*it);
const typename Tr::Vertex_handle v0 = c.vertex(0);
const typename Tr::Vertex_handle v1 = c.vertex(1);
const typename Tr::Vertex_handle v2 = c.vertex(2);
const typename Tr::Vertex_handle v3 = c.vertex(3);
vtk_file << indent;
vtk_file << V[v0->point()] << " ";
vtk_file << V[v1->point()] << " ";
vtk_file << V[v2->point()] << " ";
vtk_file << V[v3->point()] << std::endl;
}
indent.erase(indent.length()-indent_size, indent_size);
vtk_file << indent + "</DataArray>" << std::endl;
// offsets
// every element is a four node tetrahedron so all offsets are multiples of 4
vtk_file << indent;
vtk_file << "<DataArray type=\"Int32\" Name=\"offsets\" Format=\"ascii\">";
vtk_file << std::endl;
i = 4;
indent += indent_unit;
for (it = c3t3.cells_in_complex_begin(); it != c3t3.cells_in_complex_end(); ++it)
{
vtk_file << indent << i << std::endl;
//.........这里部分代码省略.........