31 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> 32 #include <CGAL/Surface_mesh_default_triangulation_3.h> 33 #include <CGAL/Complex_2_in_triangulation_3.h> 35 #include <CGAL/Delaunay_triangulation_2.h> 36 #include <CGAL/Triangulation_euclidean_traits_xy_3.h> 40 typedef CGAL::Surface_mesh_default_triangulation_3 Tr;
43 typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3;
45 typedef Tr::Geom_traits GT;
47 typedef GT::Sphere_3 Sphere_3;
52 typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
53 typedef CGAL::Triangulation_euclidean_traits_xy_3<K> Gt;
54 typedef CGAL::Delaunay_triangulation_2<Gt> Delaunay;
58 class My_face_base :
public CGAL::Triangulation_face_base_2<Gt>
63 CGAL::Triangulation_face_base_2<Gt>() {}
65 CGAL::Triangulation_face_base_2<Gt>(v0,v1,v2) {}
66 My_face_base(
void* v0,
void* v1,
void* v2,
void* n0,
void* n1,
void* n2) :
67 CGAL::Triangulation_face_base_2<Gt>(v0,v1,v2,n0,n1,n2) {}
69 typedef struct {
double r;
double g;
double b;
double a;}
COLOR;
73 glEnable(GL_LIGHTING);
74 glEnable( GL_LIGHT0 );
77 glDisable(GL_LIGHTING);
85 double AreaMean = pEdge(CLat1)*pEdge(CLat2)*.5/(double)pNChain();
88 Delaunay::Finite_vertices_iterator vUp = dtUp.finite_vertices_begin();
89 for(
int c=0;c<pNChain();c++){
93 if(!CHAIN_IF_TYPE(Chc,NChType))
continue;
95 if(CHAIN_IF_TYPE(Chc,CHAIN_UP))
98 if(CHAIN_IF_TYPE(Chc,CHAIN_FLABBY))
101 if(CHAIN_IF_TYPE(Chc,CHAIN_TILTED))
104 Pos[d] = Ch[c].Pos[d] - floor(Ch[c].Pos[d]*pInvEdge(d))*pEdge(d);
105 if(CHAIN_IF_TYPE(Ch[c].Type,CHAIN_UP) ){
106 K::Point_3 ChPos(Pos[0],Pos[1],Pos[2]);
111 K::Point_3 ChPos(Pos[0],Pos[1],Pos[2]);
112 dtDown.insert(ChPos);
116 Delaunay::Face_iterator fcTrUp = dtUp.finite_faces_begin();
117 Delaunay::Face_iterator fcTrDown = dtDown.finite_faces_begin();
121 for(
int p=0;fcTrUp != dtUp.faces_end(); ++fcTrUp,p++){
122 Delaunay::Vertex_handle vf1 = fcTrUp->vertex(0),
123 vf2 = fcTrUp->vertex(1),vf3 = fcTrUp->vertex(2);
124 K::Point_3 pf1 = vf1->point();
125 K::Point_3 pf2 = vf2->point();
126 K::Point_3 pf3 = vf3->point();
127 Vettore v1(pf1.x(),pf1.y(),pf1.z());
128 Vettore v2(pf2.x(),pf2.y(),pf2.z());
129 Vettore v3(pf3.x(),pf3.y(),pf3.z());
134 vN = (v1-v2) ^ (v3-v2);
135 glEnable(GL_LIGHTING);
136 double Depth = pf1.z()*pInvEdge(CNorm)*Saturation+ExtParam;
138 glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,Color);
139 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,Color);
142 DrTria(&v1,&v2,&v3,&vN);
143 glDisable(GL_LIGHTING);
144 glColor4f(0.,0.,1.,1.);
145 DrTriaContour(&v1,&v2,&v3);
147 for(
int p=0;fcTrDown != dtDown.faces_end(); ++fcTrDown,p++){
148 Delaunay::Vertex_handle vf1 = fcTrDown->vertex(0),
149 vf2 = fcTrDown->vertex(1),vf3 = fcTrDown->vertex(2);
150 K::Point_3 pf1 = vf1->point();
151 K::Point_3 pf2 = vf2->point();
152 K::Point_3 pf3 = vf3->point();
153 Vettore v1(pf1.x(),pf1.y(),pf1.z());
154 Vettore v2(pf2.x(),pf2.y(),pf2.z());
155 Vettore v3(pf3.x(),pf3.y(),pf3.z());
160 vN = (v1-v2) ^ (v3-v2);
161 glEnable(GL_LIGHTING);
162 double Depth = pf1.z()*pInvEdge(CNorm)*Saturation+ExtParam;
164 glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,Color);
165 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,Color);
169 DrTria(&v1,&v2,&v3,&vN);
170 glDisable(GL_LIGHTING);
171 glColor4f(1.,0.,0.,1.);
172 DrTriaContour(&v1,&v2,&v3);
174 glDisable(GL_LIGHTING);
175 for(
int n=0;n<pNNano();n++) DrawNano(n);
178 #include <CGAL/Triangulation_3.h> 179 typedef CGAL::Triangulation_3<K> Triang;
184 double AreaMean = pEdge(CLat1)*pEdge(CLat2)*.5/(double)pNChain();
185 std::list<Triang::Point> LipPos;
186 Delaunay::Finite_vertices_iterator vUp = dtUp.finite_vertices_begin();
187 for(
int b=0,cOff=0;b<pNBlock();b++,cOff+=Block[b].NChain){
188 for(
int c=cOff;c<pNChain(b)+cOff;c+=20){
189 int Chc = Ch[c].Type;
190 if(!CHAIN_IF_TYPE(Chc,NChType))
continue;
192 if(CHAIN_IF_TYPE(Chc,CHAIN_UP))
195 if(CHAIN_IF_TYPE(Chc,CHAIN_FLABBY))
198 if(CHAIN_IF_TYPE(Chc,CHAIN_TILTED))
200 Triang::Point LipPoint(Ch[c].Pos[CLat1],Ch[c].Pos[CLat2],Ch[c].Pos[CNorm]);
201 LipPos.push_front(LipPoint);
205 Triang Tr(LipPos.begin(),LipPos.end());
206 Triang::size_type NVert = Tr.number_of_vertices();
207 std::vector<Triang::Point> V(3);
208 assert(Tr.is_valid());
223 Triang::Finite_cells_iterator CIt = Tr.finite_cells_begin();
224 for(
int p=0;CIt != Tr.finite_cells_end();++CIt,p++){
225 Triang::Vertex_handle vf1 = CIt->vertex(0),vf2 = CIt->vertex(1),vf3 = CIt->vertex(2);
226 K::Point_3 pf1 = vf1->point();
227 K::Point_3 pf2 = vf2->point();
228 K::Point_3 pf3 = vf3->point();
229 Vettore v1(pf1.x(),pf1.y(),pf1.z());
230 Vettore v2(pf2.x(),pf2.y(),pf2.z());
231 Vettore v3(pf3.x(),pf3.y(),pf3.z());
236 vN = (v1-v2) ^ (v3-v2);
238 double Sfumatura = .3*Mat->Casuale();
239 glColor4f(0.1,.4+Sfumatura,0.2,1.);
241 DrTria(&v1,&v2,&v3,&vN);
242 glColor4f(0.,.0,0.,1.);
243 DrTriaContour(&v1,&v2,&v3);
245 for(
int n=0;n<pNNano();n++) DrawNano(n);
248 #include <CGAL/Surface_mesh_default_triangulation_3.h> 249 #include <CGAL/Complex_2_in_triangulation_3.h> 250 #include <CGAL/make_surface_mesh.h> 251 #include <CGAL/Implicit_surface_3.h> 254 typedef CGAL::Surface_mesh_default_triangulation_3 Tr;
257 typedef CGAL::Complex_2_in_triangulation_3<Tr> C2t3;
259 typedef Tr::Geom_traits GT;
260 typedef GT::Sphere_3 Sphere_3;
261 typedef GT::Point_3 Point_3;
264 typedef FT (*Function)(Point_3);
266 typedef CGAL::Implicit_surface_3<GT, Function> Surface_3;
268 FT sphere_function (Point_3 p) {
269 const FT x2=p.x()*p.x(), y2=p.y()*p.y(), z2=p.z()*p.z();
275 Surface_3 surface(sphere_function,Sphere_3(CGAL::ORIGIN, 2.));
276 CGAL::Surface_mesh_default_criteria_3<Tr> criteria(30.,
279 CGAL::make_surface_mesh(c2t3, surface, criteria, CGAL::Non_manifold_tag());
283 Tr::Finite_cells_iterator CIt = tr.finite_cells_begin();
284 for(
int p=0;CIt != tr.finite_cells_end();++CIt,p++){
285 Tr::Vertex_handle vf1 = CIt->vertex(0),vf2 = CIt->vertex(1),vf3 = CIt->vertex(2);
286 K::Point_3 pf1 = vf1->point();
287 K::Point_3 pf2 = vf2->point();
288 K::Point_3 pf3 = vf3->point();
289 Vettore v1(pf1.x(),pf1.y(),pf1.z());
290 Vettore v2(pf2.x(),pf2.y(),pf2.z());
291 Vettore v3(pf3.x(),pf3.y(),pf3.z());
296 vN = (v1-v2) ^ (v3-v2);
298 double Sfumatura = .3*Mat->Casuale();
299 glColor4f(0.1,.4+Sfumatura,0.2,1.);
301 DrTria(&v1,&v2,&v3,&vN);
302 glColor4f(1.,.0,0.,1.);
303 DrTriaContour(&v1,&v2,&v3);
305 for(
int n=0;n<pNNano();n++) DrawNano(n);
310 printf(
"DefSurface without CGAL not implemented\n");
313 printf(
"DefSurface without CGAL not implemented\n");
316 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 DrGenMesh()
Generate a mesh from a function.
void DepthMap(double Val, GLfloat *Color)
Pointer to a generic function.
void DrTriangulate()
Triangulate a surface.
void DrCells()
Construct cells from the lipid positions.
int IfMaterial
Activate the illumination for a specific material.
void DrMesh()
Build a mesh from the lipid positions.
GLuint Particles
Refers to the list of the total position of the particles which will be generated in another program...