Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: the problem when inserted line feature in to Mesh_domain_with_polyline_features_3

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: the problem when inserted line feature in to Mesh_domain_with_polyline_features_3


Chronological Thread 
  • From: neman <>
  • To:
  • Subject: [cgal-discuss] Re: the problem when inserted line feature in to Mesh_domain_with_polyline_features_3
  • Date: Tue, 22 Mar 2011 08:18:52 -0700 (PDT)

Here is my code about this problem, Is there anybody to help me to test this
code if it can work well on different envoriment?

#include &lt;CGAL/Exact_predicates_inexact_constructions_kernel.h&gt;
#include &lt;CGAL/Delaunay_triangulation_3.h&gt;
#include &lt;CGAL/Triangulation_vertex_base_with_info_3.h&gt;
#include &lt;CGAL/Mesh_3/Robust_intersection_traits_3.h&gt;
#include &lt;CGAL/Mesh_triangulation_3.h&gt;
#include &lt;CGAL/Mesh_complex_3_in_triangulation_3.h&gt;
#include &lt;CGAL/Mesh_criteria_3.h&gt;
#include &lt;CGAL/Polyhedral_mesh_domain_3.h&gt;
#include &lt;CGAL/make_mesh_3.h&gt;
#include &lt;CGAL/refine_mesh_3.h&gt;
#include &lt;CGAL/IO/Polyhedron_iostream.h&gt;
#include &lt;CGAL/Mesh_domain_with_polyline_features_3.h&gt;

typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Mesh_3::Robust_intersection_traits_3 Geom_traits;
typedef Geom_traits::Point_3 Point_3;
typedef CGAL::Polyhedron_3 Polyhedron;
typedef CGAL::Mesh_domain_with_polyline_features_3<
CGAL::Polyhedral_mesh_domain_3&lt;Polyhedron, Geom_traits&gt; >
MD_IntersectedLines;
typedef CGAL::Mesh_triangulation_3::type Tr_MDI;
typedef CGAL::Mesh_criteria_3 Mesh_criteria_MDI;
typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3_MDI;
typedef C3t3_MDI::Facets_in_complex_iterator Facet_Iter_inComplex;
typedef std::vector InterPolyline;
typedef std::list InterPolylines;

using namespace CGAL::parameters;

int main()
{
Polyhedron bounding_box; //包围盒
//top face
bounding_box.make_triangle(Point_3(100,100,100), Point_3(0,100,100),
Point_3(0,0,100));
bounding_box.make_triangle(Point_3(100,100,100), Point_3(0,0,100),
Point_3(100,0,100));
//bottom face
bounding_box.make_triangle(Point_3(100,100,0), Point_3(100,0,0),
Point_3(0,0,0));
bounding_box.make_triangle(Point_3(100,100,0), Point_3(0,0,0),
Point_3(0,100,0));
//front face
bounding_box.make_triangle(Point_3(0,0,0), Point_3(100,0,100),
Point_3(0,0,100));
bounding_box.make_triangle(Point_3(0,0,0), Point_3(100,0,0),
Point_3(100,0,100));
//back face
bounding_box.make_triangle(Point_3(0,100,0), Point_3(0,100,100),
Point_3(100,100,100));
bounding_box.make_triangle(Point_3(100,100,100), Point_3(100,100,0),
Point_3(0,100,0));
//left face
bounding_box.make_triangle(Point_3(0,0,0), Point_3(0,0,100),
Point_3(0,100,100));
bounding_box.make_triangle(Point_3(0,0,0), Point_3(0,100,100),
Point_3(0,100,0));
//right face
bounding_box.make_triangle(Point_3(100,100,100), Point_3(100,0,0),
Point_3(100,100,0));
bounding_box.make_triangle(Point_3(100,100,100), Point_3(100,0,100),
Point_3(100,0,0));

std::vector&lt;Polyhedron*&gt; AllSurfaces; //所有限定面
Polyhedron NewPoly_1;
NewPoly_1.make_triangle(Point_3(20,20,20), Point_3(25,20,20),
Point_3(25,40,20));
NewPoly_1.make_triangle(Point_3(20,20,20), Point_3(25,40,20),
Point_3(20,40,20));
AllSurfaces.push_back(&NewPoly_1);
Polyhedron NewPoly_2;
NewPoly_2.make_triangle(Point_3(25,40,20), Point_3(25,20,20),
Point_3(60,20,20));
NewPoly_2.make_triangle(Point_3(60,40,20), Point_3(25,40,20),
Point_3(60,20,20));
AllSurfaces.push_back(&NewPoly_2);

InterPolylines interPolySet;
InterPolyline interLine;
interLine.push_back(Point_3(25,40,20));
interLine.push_back(Point_3(25,20,20));
interPolySet.push_back(interLine);

MD_IntersectedLines domain(AllSurfaces.begin(), AllSurfaces.end(),
bounding_box);
domain.add_features(interPolySet.begin(), interPolySet.end());
Mesh_criteria_MDI criteria(facet_angle=20, cell_size=300,
facet_topology =
CGAL::FACET_VERTICES_ON_SURFACE);
C3t3_MDI c3t3 = CGAL::make_mesh_3(domain, criteria);
// Output
std::ofstream medit_file("out_1.mesh");
c3t3.output_to_medit(medit_file);
medit_file.close();
}

--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/the-problem-when-inserted-line-feature-in-to-Mesh-domain-with-polyline-features-3-tp3393653p3396687.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page