Skip to content
Snippets Groups Projects
Commit a976f454 authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

A function was bugging gcc 3.3.3
parent 71b15288
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
// //
// Please report all bugs and problems to <gmsh@geuz.org>. // Please report all bugs and problems to <gmsh@geuz.org>.
#include <set>
using namespace std; using namespace std;
...@@ -55,6 +54,7 @@ struct lessthanxyzv ...@@ -55,6 +54,7 @@ struct lessthanxyzv
} }
}; };
#include <set>
typedef set < xyzv, lessthanxyzv > xyzcont; typedef set < xyzv, lessthanxyzv > xyzcont;
typedef xyzcont::const_iterator xyziter; typedef xyzcont::const_iterator xyziter;
......
// $Id: Entity.cpp,v 1.46 2004-08-16 17:52:59 remacle Exp $ // $Id: Entity.cpp,v 1.47 2004-09-14 10:33:37 remacle Exp $
// //
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
// //
...@@ -19,15 +19,106 @@ ...@@ -19,15 +19,106 @@
// //
// Please report all bugs and problems to <gmsh@geuz.org>. // Please report all bugs and problems to <gmsh@geuz.org>.
#include "Mesh.h"
#include "Gmsh.h" #include "Gmsh.h"
#include "GmshUI.h" #include "GmshUI.h"
#include "Numeric.h" #include "Numeric.h"
#include "Mesh.h"
#include "Draw.h" #include "Draw.h"
#include "Context.h" #include "Context.h"
extern Context_T CTX; extern Context_T CTX;
class point{
public:
double x, y, z;
bool valid;
point() : x(0.), y(0.), z(0.), valid(false) {;};
point(double xi, double yi, double zi) :
x(xi), y(yi), z(zi), valid(true) {;};
};
class plane{
private:
double _a, _b, _c, _d;
public:
plane(double a, double b, double c, double d) :
_a(a), _b(b), _c(c), _d(d) {;};
double val(point &p){
return _a*p.x + _b*p.y + _c*p.z + _d;
};
point intersect(point &p1, point &p2){
double v1 = val(p1), v2 = val(p2);
if(fabs(v1) < 1.e-12){
if(fabs(v2) < 1.e-12)
return point();
else
return point(p1.x, p1.y, p1.z);
}
else if(fabs(v2) < 1.e-12){
return point(p2.x, p2.y, p2.z);
}
else if(v1 * v2 < 0.){
double coef = - v1 / (v2 - v1);
return point(coef * (p2.x - p1.x) + p1.x,
coef * (p2.y - p1.y) + p1.y,
coef * (p2.z - p1.z) + p1.z);
}
else
return point();
};
};
void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin,
double xmax, double ymax, double zmax,
double a, double b, double c, double d)
{
plane pl(a, b, c, d);
point p1(xmin, ymin, zmin), p2(xmax, ymin, zmin);
point p3(xmax, ymax, zmin), p4(xmin, ymax, zmin);
point p5(xmin, ymin, zmax), p6(xmax, ymin, zmax);
point p7(xmax, ymax, zmax), p8(xmin, ymax, zmax);
point edge[12];
edge[0] = pl.intersect(p1, p2);
edge[1] = pl.intersect(p1, p4);
edge[2] = pl.intersect(p1, p5);
edge[3] = pl.intersect(p2, p3);
edge[4] = pl.intersect(p2, p6);
edge[5] = pl.intersect(p3, p4);
edge[6] = pl.intersect(p3, p7);
edge[7] = pl.intersect(p4, p8);
edge[8] = pl.intersect(p5, p6);
edge[9] = pl.intersect(p5, p8);
edge[10] = pl.intersect(p6, p7);
edge[11] = pl.intersect(p7, p8);
int face[6][4] = {
{0, 2, 4, 8},
{0, 1, 3, 5},
{1, 2, 7, 9},
{3, 4, 6, 10},
{5, 6, 7, 11},
{8, 9, 10, 11}
};
for(int i = 0; i < 6; i++){
int nb = 0;
point p[4];
for(int j = 0; j < 4; j++){
if(edge[face[i][j]].valid == true)
p[nb++] = edge[face[i][j]];
}
if(nb > 1){
glColor3d(1.,0.,0.);
glBegin(GL_LINE_STRIP);
for(int j = 0; j < nb; j++)
glVertex3d(p[j].x, p[j].y, p[j].z);
glEnd();
}
}
}
void Draw_Point(int type, double size, double *x, double *y, double *z, void Draw_Point(int type, double size, double *x, double *y, double *z,
double Raise[3][8], int light) double Raise[3][8], int light)
{ {
...@@ -63,6 +154,7 @@ void Draw_Sphere(double size, double x, double y, double z, int light) ...@@ -63,6 +154,7 @@ void Draw_Sphere(double size, double x, double y, double z, int light)
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
} }
void Draw_Disk(double size, double rint, double x, double y, double z, int light) void Draw_Disk(double size, double rint, double x, double y, double z, int light)
{ {
if(light) glEnable(GL_LIGHTING); if(light) glEnable(GL_LIGHTING);
...@@ -290,6 +382,7 @@ void Draw_SimpleVector(int arrow, int fill, ...@@ -290,6 +382,7 @@ void Draw_SimpleVector(int arrow, int fill,
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
} }
void Draw_3DArrow(double relHeadRadius, double relStemLength, double relStemRadius, void Draw_3DArrow(double relHeadRadius, double relStemLength, double relStemRadius,
double x, double y, double z, double dx, double dy, double dz, double x, double y, double z, double dx, double dy, double dz,
double length, int light) double length, int light)
...@@ -386,92 +479,7 @@ void Draw_Vector(int Type, int Fill, ...@@ -386,92 +479,7 @@ void Draw_Vector(int Type, int Fill,
} }
void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin,
double xmax, double ymax, double zmax,
double a, double b, double c, double d)
{
class point{
public:
double x, y, z;
bool valid;
point() : x(0.), y(0.), z(0.), valid(false) {;};
point(double xi, double yi, double zi) :
x(xi), y(yi), z(zi), valid(true) {;};
};
class plane{
private:
double _a, _b, _c, _d;
public:
plane(double a, double b, double c, double d) :
_a(a), _b(b), _c(c), _d(d) {;};
double val(point &p){
return _a*p.x + _b*p.y + _c*p.z + _d;
};
point intersect(point &p1, point &p2){
double v1 = val(p1), v2 = val(p2);
if(fabs(v1) < 1.e-12){
if(fabs(v2) < 1.e-12)
return point();
else
return point(p1.x, p1.y, p1.z);
}
else if(fabs(v2) < 1.e-12){
return point(p2.x, p2.y, p2.z);
}
else if(v1 * v2 < 0.){
double coef = - v1 / (v2 - v1);
return point(coef * (p2.x - p1.x) + p1.x,
coef * (p2.y - p1.y) + p1.y,
coef * (p2.z - p1.z) + p1.z);
}
else
return point();
};
};
plane pl(a, b, c, d);
point p1(xmin, ymin, zmin), p2(xmax, ymin, zmin);
point p3(xmax, ymax, zmin), p4(xmin, ymax, zmin);
point p5(xmin, ymin, zmax), p6(xmax, ymin, zmax);
point p7(xmax, ymax, zmax), p8(xmin, ymax, zmax);
point edge[12];
edge[0] = pl.intersect(p1, p2);
edge[1] = pl.intersect(p1, p4);
edge[2] = pl.intersect(p1, p5);
edge[3] = pl.intersect(p2, p3);
edge[4] = pl.intersect(p2, p6);
edge[5] = pl.intersect(p3, p4);
edge[6] = pl.intersect(p3, p7);
edge[7] = pl.intersect(p4, p8);
edge[8] = pl.intersect(p5, p6);
edge[9] = pl.intersect(p5, p8);
edge[10] = pl.intersect(p6, p7);
edge[11] = pl.intersect(p7, p8);
int face[6][4] = {
{0, 2, 4, 8},
{0, 1, 3, 5},
{1, 2, 7, 9},
{3, 4, 6, 10},
{5, 6, 7, 11},
{8, 9, 10, 11}
};
for(int i = 0; i < 6; i++){
int nb = 0;
point p[4];
for(int j = 0; j < 4; j++){
if(edge[face[i][j]].valid == true)
p[nb++] = edge[face[i][j]];
}
if(nb > 1){
glColor3d(1.,0.,0.);
glBegin(GL_LINE_STRIP);
for(int j = 0; j < nb; j++)
glVertex3d(p[j].x, p[j].y, p[j].z);
glEnd();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment