30 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> 31 #include <CGAL/Surface_mesh_default_triangulation_3.h> 32 #include <CGAL/Complex_2_in_triangulation_3.h> 34 #include <CGAL/Delaunay_triangulation_2.h> 35 #include <CGAL/Triangulation_euclidean_traits_xy_3.h> 39 typedef CGAL::Surface_mesh_default_triangulation_3 Tr;
42 typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3;
44 typedef Tr::Geom_traits GT;
46 typedef GT::Sphere_3 Sphere_3;
51 typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
52 typedef CGAL::Triangulation_euclidean_traits_xy_3<K> Gt;
53 typedef CGAL::Delaunay_triangulation_2<Gt> Delaunay;
57 class My_face_base :
public CGAL::Triangulation_face_base_2<Gt>
62 CGAL::Triangulation_face_base_2<Gt>() {}
64 CGAL::Triangulation_face_base_2<Gt>(v0,v1,v2) {}
65 My_face_base(
void* v0,
void* v1,
void* v2,
void* n0,
void* n1,
void* n2) :
66 CGAL::Triangulation_face_base_2<Gt>(v0,v1,v2,n0,n1,n2) {}
68 typedef struct {
double r;
double g;
double b;
double a;}
COLOR;
78 double AreaMean = Gen->Edge[CLat1]*Gen->Edge[CLat2]*.5/(double)Gen->NChain;
79 Delaunay::Finite_vertices_iterator vUp = dtUp.finite_vertices_begin();
80 for(
int c=0;c<Gen->NChain;c++){
82 if(Ch[c].Pos[CNorm] > .7*Gen->Edge[CNorm])
continue;
83 if(Ch[c].Pos[CNorm] < .3*Gen->Edge[CNorm])
continue;
84 if(!CHAIN_IF_TYPE(Chc,NChType))
continue;
86 if(CHAIN_IF_TYPE(Chc,CHAIN_UP))
89 if(CHAIN_IF_TYPE(Chc,CHAIN_FLABBY))
92 if(CHAIN_IF_TYPE(Chc,CHAIN_TILTED))
94 if(CHAIN_IF_TYPE(Ch[c].Type,CHAIN_UP) ){
95 K::Point_3 ChPos(Ch[c].Pos[CLat1],Ch[c].Pos[CLat2],Ch[c].Pos[CNorm]);
100 K::Point_3 ChPos(Ch[c].Pos[CLat1],Ch[c].Pos[CLat2],Ch[c].Pos[CNorm]);
101 dtDown.insert(ChPos);
105 Delaunay::Face_iterator fcTrUp = dtUp.finite_faces_begin();
106 Delaunay::Face_iterator fcTrDown = dtDown.finite_faces_begin();
110 for(
int p=0;fcTrUp != dtUp.faces_end(); ++fcTrUp,p++){
111 Delaunay::Vertex_handle vf1 = fcTrUp->vertex(0),
112 vf2 = fcTrUp->vertex(1),vf3 = fcTrUp->vertex(2);
113 K::Point_3 pf1 = vf1->point();
114 K::Point_3 pf2 = vf2->point();
115 K::Point_3 pf3 = vf3->point();
116 Vettore v1(pf1.x(),pf1.y(),pf1.z());
117 Vettore v2(pf2.x(),pf2.y(),pf2.z());
118 Vettore v3(pf3.x(),pf3.y(),pf3.z());
123 vN = (v1-v2) ^ (v3-v2);
125 glColor4f(0.,.7,0.,1.);
127 DrTria(&v1,&v2,&v3,&vN);
128 glColor4f(0.,.0,0.,1.);
129 DrTriaContour(&v1,&v2,&v3);
131 for(
int p=0;fcTrDown != dtDown.faces_end(); ++fcTrDown,p++){
132 Delaunay::Vertex_handle vf1 = fcTrDown->vertex(0),
133 vf2 = fcTrDown->vertex(1),vf3 = fcTrDown->vertex(2);
134 K::Point_3 pf1 = vf1->point();
135 K::Point_3 pf2 = vf2->point();
136 K::Point_3 pf3 = vf3->point();
137 Vettore v1(pf1.x(),pf1.y(),pf1.z());
138 Vettore v2(pf2.x(),pf2.y(),pf2.z());
139 Vettore v3(pf3.x(),pf3.y(),pf3.z());
144 vN = (v1-v2) ^ (v3-v2);
146 glColor4f(0.,.7,0.,1.);
148 DrTria(&v1,&v2,&v3,&vN);
149 glColor4f(0.,.0,0.,1.);
150 DrTriaContour(&v1,&v2,&v3);
158 #include <CGAL/Skin_surface_3.h> 160 #include <CGAL/mesh_skin_surface_3.h> 161 #include <CGAL/subdivide_skin_surface_mesh_3.h> 163 #include <CGAL/Polyhedron_3.h> 165 #include "skin_surface_writer.h" 166 #include <CGAL/IO/Polyhedron_iostream.h> 167 #include <CGAL/subdivide_skin_surface_mesh_3.h> 168 #include <CGAL/Skin_surface_refinement_policy_3.h> 172 typedef CGAL::Skin_surface_traits_3<K> Traits;
173 typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
174 typedef Skin_surface_3::FT FT;
175 typedef Skin_surface_3::Weighted_point Weighted_point;
176 typedef Weighted_point::Point Bare_point;
177 typedef CGAL::Polyhedron_3<K,
178 CGAL::Skin_surface_polyhedral_items_3<Skin_surface_3> > Polyhedron;
179 typedef Polyhedron::Traits::Vector_3 Vector;
181 #include <CGAL/Skin_surface_refinement_policy_3.h> 188 list <Weighted_point> WeiPoint;
189 double shrinkfactor = 1.0;
191 for(
int c=0;c<4;c++){
192 Bare_point ChPoint(Ch[c].Pos[0]*InvScaleUn,Ch[c].Pos[1]*InvScaleUn,Ch[c].Pos[2]*InvScaleUn);
193 WeiPoint.push_front(Weighted_point(ChPoint, 0.5));
197 Skin_surface_3 skin_surface(WeiPoint.begin(),WeiPoint.end(),shrinkfactor);
198 CGAL::mesh_skin_surface_3(skin_surface,Polyhe);
199 CGAL::subdivide_skin_surface_mesh_3(skin_surface,Polyhe);
200 std::ofstream out(
"mesh.off");
208 glColor4f(0.0,0.0,0.0,1.0);
275 printf(
"DefSurface without CGAL not implemented\n");
Draw provides the basic configuration of the openGL libraries used in every derived program...
Geometrical operations on vectors.
void DefineSkin(int NSample)
Find the covering surface for given points.
void DrTriangulate()
Triangulate a surface.
GLuint Particles
Refers to the list of the total position of the particles which will be generated in another program...