本文整理汇总了C++中Tr类的典型用法代码示例。如果您正苦于以下问题:C++ Tr类的具体用法?C++ Tr怎么用?C++ Tr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: maybeFlipInTreeBits
void maybeFlipInTreeBits() {
Tr* t;
for(std::size_t i = 0; i < inTrees.size(); i++) {
t = inTrees[i];
t->maybeFlipInTreeBits();
}
}
示例2: _test_surface_neighbors_3_sphere
void
_test_surface_neighbors_3_sphere( const Tr & )
{
Tr T;
int n=200, m=20;
double r = 3;
typedef typename Tr::Geom_traits Gt;
typedef typename Gt::Point_3 Point;
std::vector<Point> points;
points.reserve(n+m);
// Create n+m-4 points on a sphere of radius 2
CGAL::Random_points_on_sphere_3<Point> g(r);
CGAL::cpp11::copy_n( g, n+m, std::back_inserter(points));
for(int i=0; i<n ; i++)
T.insert(points[i]);
//test with different calls:
int k=0;
for(int i=n;i<n+m;i++)
{
test_coords_and_neighbors(T, points[i],
typename Gt::Vector_3(points[i]-CGAL::ORIGIN),
typename Gt::FT(0.5),++k % 8);
}
}
示例3: 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);
}
示例4: 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";
}
示例5: setInTreeInternalBits
void setInTreeInternalBits() {
Tr* t;
for(std::size_t i = 0; i < inTrees.size(); i++) {
t = inTrees[i];
//std::cout << "Stm->setInTreeInternalBits() setting internal bits for inTree " << i << std::endl;
t->setInternalBits();
}
}
示例6: setInTreeTaxBits
void setInTreeTaxBits() {
Tr* t;
for(std::size_t i = 0; i < inTrees.size(); i++) {
t = inTrees[i];
t->setInTreeTaxBits();
//std::cout << "Stm.setInTreeTaxBits() setting taxBits for inTree " << i << " to " << t->taxBits;
//std::cout << " firstOnePos " << t->firstOnePos << std::endl;
}
}
示例7: main
int main(int , char** argv)
{
Tr tr;
C2T3 c2t3(tr);
std::ifstream ifs(argv[1]);
if( !ifs )
{
std::cerr << "Usage:\n"
<< " " << argv[0] << " FILE\n"
<< "\n"
<< " FILE must be " << format_cgal_description
<< "\n";
return EXIT_FAILURE;
}
std::cout << " Reading " << argv[1] << std::endl;
if( CGAL::Mesh_3::input_mesh(ifs, c2t3,
true,
&std::cerr) )
// if( CGAL::input_pslg_from_medit(ifs,
// c2t3,
// true, // debug
// &std::cout) ) // debug to cout
{
display_faces_counts(tr, " ", &std::cout);
std::cout << "\n Statistics:\n";
std::cout << "(vertices)\n";
display_vertices_by_surface_indices_statistics(tr, " ", &std::cout);
std::cout << "(facets)\n";
display_facets_by_surface_indices_statistics(c2t3, " ", &std::cout);
Compute_min_angle<Tr> min_angle(tr);
double min = 180;
for(Tr::Finite_cells_iterator cit = tr.finite_cells_begin();
cit != tr.finite_cells_end();
++cit)
if(cit->is_in_domain())
{
const double angle = min_angle(cit);
if( angle < min ) min = angle;
}
std::cout << "\nmin angle: " << min << "\n";
return EXIT_SUCCESS;
}
else
return EXIT_FAILURE;
}
示例8: test_coords_and_neighbors
void
test_coords_and_neighbors(const Tr& T, const typename
Tr::Geom_traits::Point_3& p,
const typename Tr::Geom_traits::Vector_3& n,
const typename Tr::Geom_traits::FT& tolerance, const int& version)
{
CGAL::Set_ieee_double_precision pfr;
typedef std::pair<typename Tr::Geom_traits::Point_3,
typename Tr::Geom_traits::FT > Point_coord_pair;
std::vector<Point_coord_pair> coords;
typename Tr::Geom_traits::FT norm;
norm = test_coords(T, p, n,version, std::back_inserter(coords)).second;
assert(test_norm( coords.begin(), coords.end(), norm));
assert(test_barycenter(coords.begin(), coords.end(), norm, p, tolerance));
//All function testing surface neighbors are
// grouped together:
std::vector< typename Tr::Geom_traits::Point_3 > neighbors;
test_neighbors(T, p, n,version, std::back_inserter(neighbors));
assert(compare_neighbors(coords.begin(),
coords.end(),neighbors.begin(),
neighbors.end(), T.geom_traits()));
//done
}
示例9: dump
void dump() {
std::cout << "Stm dump(), nTax=" << this->nTax << std::endl;
if(this->bigT == NULL) {
std::cout << " bigT is not set" << std::endl;
} else {
std::cout << "---- bigT dump ---------" << std::endl;
this->bigT->dump();
std::cout << "---- end of bigT dump --" << std::endl;
}
Tr* t;
for(std::size_t i = 0; i < inTrees.size(); i++) {
t = this->inTrees[i];
std::cout << "---- inTree " << i << " dump ---------" << std::endl;
t->dump();
std::cout << "--------" << std::endl;
}
}
示例10: 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";
}
示例11: 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";
}
示例12: main
int main()
{
CGAL::Timer t;
t.start();
// Define functions
Function f1(&torus_function);
Function f2(&sphere_function<5>);
Function f3(&tanglecube_function);
Function f4(&heart_function);
Function f5(&klein_function);
Function f6(&false_knot_function);
Function f7(&knot1_function);
Function f8(&octic_function);
Function_vector v;
v.push_back(&f1);
//v.push_back(&f2);
//v.push_back(&f3);
//v.push_back(&f4);
//v.push_back(&f5);
//v.push_back(&f6);
//v.push_back(&f7);
//v.push_back(&f8);
// Domain (Warning: Sphere_3 constructor uses square radius !)
Mesh_domain domain(v, K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6);
// Set mesh criteria
Facet_criteria facet_criteria(30, 0.2, 0.02); // angle, size, approximation
Cell_criteria cell_criteria(2., 0.4); // radius-edge ratio, size
Mesh_criteria criteria(facet_criteria, cell_criteria);
// Mesh generation
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_exude(), no_perturb());
// Perturbation (maximum cpu time: 10s, targeted dihedral angle: default)
CGAL::perturb_mesh_3(c3t3, domain, time_limit = 10);
// Exudation
CGAL::exude_mesh_3(c3t3,12);
CGAL::Random rand;
t.stop();
std::cout << "Time elapsed for building the mesh: " << t.time() << std::endl;
t.reset();
t.start();
int nr = 1500;
std::vector<Point> points;
points.reserve(nr);
CGAL::Random_points_in_mesh_3<Point, C3t3, FastPolicy> g(c3t3);
t.stop();
std::cout << "Time elapsed for init Random_points_in_mesh_3: " <<
t.time() << std::endl;
t.reset();
t.start();
CGAL::cpp11::copy_n( g, nr, std::back_inserter(points));
t.stop();
std::cout << "Time elapsed for generating the points: " << t.time() << std::endl;
t.reset();
Tr tr = c3t3.triangulation();
Tetrahedron3 tet;
Tr::Finite_cells_iterator it = tr.finite_cells_begin();
for (; it != tr.finite_cells_end(); it++) {
if (c3t3.is_in_complex(it)) {
tet = tr.tetrahedron(it);
break;
}
}
t.start();
std::vector<Point> points_tet;
points_tet.reserve(nr);
CGAL::Random_points_in_tetrahedron_3<Point> g1(tet);
CGAL::cpp11::copy_n(g1, nr, std::back_inserter(points_tet));
t.stop();
std::cout << "Time elapsed for " << nr << " points in one tetrahedron: " <<
t.time() << std::endl;
t.reset();
std::cout << "The generated points are: " << std::endl;
for (int i = 0; i < nr; i++) {
std::cout << points[i].x() << " " << points[i].y() << " " <<
points[i].z() << std::endl;
}
points_tet.clear();
points.clear();
v.clear();
return 0;
}
示例13: sqr_it
void sqr_it(Tr &ob){
ob.set_i(ob.get_i()*ob.get_i());
cout<<"经过sqr_it()函数后数据成员为:"<<ob.get_i()<<endl;
}
示例14: test_neighbors
OutputIterator
test_neighbors(const Tr& T, const typename Tr::Geom_traits::Point_3& p,
const typename Tr::Geom_traits::Vector_3& n,
const int& version,
OutputIterator out)
{
typedef CGAL::Voronoi_intersection_2_traits_3<typename Tr::Geom_traits> I_traits;
//the result type of the certified version:
typedef std::pair< OutputIterator, bool > NeighborIt_bool_pair;
typename Tr::Cell_handle start;
//test different function calls
switch(version)
{
case 0:{
//certified call with Kernel:
NeighborIt_bool_pair
result_pair = CGAL::surface_neighbors_certified_3(T.points_begin(),
T.points_end(), p, n,
out,
T.geom_traits());
assert(result_pair.second);
out = result_pair.first; break;}
case 1: {
//certified call with instantiated traits::
NeighborIt_bool_pair
result_pair = CGAL::surface_neighbors_certified_3(T.points_begin(),
T.points_end(), p,
out, I_traits(p,n));
assert(result_pair.second);
out =result_pair.first; break;}
//both versions with locate:
case 2:{
start = T.locate(p);
//certified call with Kernel and locate:
out =CGAL::surface_neighbors_3(T, p,n,out, start);
break;}
case 3: {
start = T.locate(p);
//with instantiated traits and locate:
out =CGAL::surface_neighbors_3(T,p,out, I_traits(p,n),start);
break;}
//taking all points:
case 4: {
//with instantiated traits and locate:
out =
CGAL::surface_neighbors_3(T,p,out,I_traits(p,n));
break;}
case 5: {
//certified call with Kernel and locate:
out =
CGAL::surface_neighbors_3(T, p,n,out);
break;}
//the last two with certification:
case 6: {
out =
CGAL::surface_neighbors_3(T.points_begin(),
T.points_end(),
p, out,I_traits(p,n));
break;
}
case 7: {
out =
CGAL::surface_neighbors_3(T.points_begin(),
T.points_end(),
p,n,out,T.geom_traits());
break;
}
default:
std::cout << "Switch function calls: Nothing is tested. " <<
std::endl;
}
return out;
}
示例15: test_coords
std::pair< OutputIterator, typename Tr::Geom_traits::FT>
test_coords(const Tr& T,
const typename Tr::Geom_traits::Point_3& p,
const typename Tr::Geom_traits::Vector_3& n,
const int& version, OutputIterator out)
{
typedef CGAL::Voronoi_intersection_2_traits_3<typename Tr::Geom_traits> I_traits;
//coordinate computation result types
typedef CGAL::Triple< OutputIterator, typename Tr::Geom_traits::FT, bool > Result_triple;
//the result type of the certified version:
typedef CGAL::Quadruple< OutputIterator, typename Tr::Geom_traits::FT, bool, bool > Result_quadruple;
typename Tr::Cell_handle start;
typename Tr::Geom_traits::FT norm = 1; // 1 for that default doesn't trigger an assert
//test different function calls
switch(version){
case 0:{
Result_triple result
= CGAL::surface_neighbor_coordinates_3(T, p,n,out);
assert(result.third);
norm = result.second;
break;}
case 1: {
Result_triple result =
CGAL::surface_neighbor_coordinates_3(T, p,out,I_traits(p,n));
assert(result.third);
norm = result.second; break;}
//both versions with locate:
case 2:{
start = T.locate(p);
Result_triple result = CGAL::surface_neighbor_coordinates_3(T, p, n, out, start);
assert(result.third);
norm = result.second; break;}
case 3: {
start = T.locate(p);
Result_triple result =
CGAL::surface_neighbor_coordinates_3(T, p, out, I_traits(p,n), start);
assert(result.third);
norm = result.second; break;}
//taking all points:
case 4: {
Result_triple result
= CGAL::surface_neighbor_coordinates_3(T.points_begin(),
T.points_end(), p, n,
out,
T.geom_traits());
assert(result.third);
norm = result.second; break;}
case 5: {
Result_triple result
= CGAL::surface_neighbor_coordinates_3(T.points_begin(),
T.points_end(), p,
out ,I_traits(p,n));
assert(result.third);
norm = result.second; break;}
//the last two with certification:
case 6: {
Result_quadruple
result = CGAL::surface_neighbor_coordinates_certified_3
(T.points_begin(), T.points_end(),p,n,
out, T.geom_traits());
assert(result.third && result.fourth);
norm = result.second; break;
}
case 7: {
Result_quadruple
result = CGAL::surface_neighbor_coordinates_certified_3
(T.points_begin(), T.points_end(),p, out ,I_traits(p,n));
assert(result.third && result.fourth);
norm = result.second;
break;
}
default:
std::cout << "Switch function calls: Nothing is tested. " <<
std::endl;
}
assert(norm > 0);
return std::make_pair(out, norm);
}