#include <gp_Dir.hxx> //Dans OpenCascade
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-// BUT: Definir les espaces affines R R2 R3 R4 soit Rn pour n=1,2,3,4
+// BUT: Definir les espaces affines R R_2 R_3 R_4 soit Rn pour n=1,2,3,4
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// AUTEUR : Frederic HECHT ANALYSE NUMERIQUE UPMC PARIS OCTOBRE 2000
// MODIFS : Alain PERRONNET ANALYSE NUMERIQUE UPMC PARIS NOVEMBRE 2000
//==============
//typedef struct { short int x,y } XPoint; //en fait ce type est defini dans X11-Window
// #include <X11/Xlib.h>
-//la classe R2
+//la classe R_2
//============
-class R2
+class R_2
{
- friend std::ostream& operator << (std::ostream& f, const R2 & P)
+ friend std::ostream& operator << (std::ostream& f, const R_2 & P)
{ f << P.x << ' ' << P.y ; return f; }
- friend std::istream& operator >> (std::istream& f, R2 & P)
+ friend std::istream& operator >> (std::istream& f, R_2 & P)
{ f >> P.x >> P.y ; return f; }
- friend std::ostream& operator << (std::ostream& f, const R2 * P)
+ friend std::ostream& operator << (std::ostream& f, const R_2 * P)
{ f << P->x << ' ' << P->y ; return f; }
- friend std::istream& operator >> (std::istream& f, R2 * P)
+ friend std::istream& operator >> (std::istream& f, R_2 * P)
{ f >> P->x >> P->y ; return f; }
public:
R x,y; //les donnees
- R2 () :x(0),y(0) {} //les constructeurs
- R2 (R a,R b) :x(a),y(b) {}
- R2 (R2 A,R2 B) :x(B.x-A.x),y(B.y-A.y) {} //vecteur defini par 2 points
-
- R2 operator+(R2 P) const {return R2(x+P.x,y+P.y);} // Q+P possible
- R2 operator+=(R2 P) {x += P.x;y += P.y; return *this;}// Q+=P;
- R2 operator-(R2 P) const {return R2(x-P.x,y-P.y);} // Q-P
- R2 operator-=(R2 P) {x -= P.x;y -= P.y; return *this;} // Q-=P;
- R2 operator-()const {return R2(-x,-y);} // -Q
- R2 operator+()const {return *this;} // +Q
- R operator,(R2 P)const {return x*P.x+y*P.y;} // produit scalaire (Q,P)
- R operator^(R2 P)const {return x*P.y-y*P.x;} // produit vectoriel Q^P
- R2 operator*(R c)const {return R2(x*c,y*c);} // produit a droite P*c
- R2 operator*=(R c) {x *= c; y *= c; return *this;}
- R2 operator/(R c)const {return R2(x/c,y/c);} // division par un reel
- R2 operator/=(R c) {x /= c; y /= c; return *this;}
+ R_2 () :x(0),y(0) {} //les constructeurs
+ R_2 (R a,R b) :x(a),y(b) {}
+ R_2 (R_2 A,R_2 B) :x(B.x-A.x),y(B.y-A.y) {} //vecteur defini par 2 points
+
+ R_2 operator+(R_2 P) const {return R_2(x+P.x,y+P.y);} // Q+P possible
+ R_2 operator+=(R_2 P) {x += P.x;y += P.y; return *this;}// Q+=P;
+ R_2 operator-(R_2 P) const {return R_2(x-P.x,y-P.y);} // Q-P
+ R_2 operator-=(R_2 P) {x -= P.x;y -= P.y; return *this;} // Q-=P;
+ R_2 operator-()const {return R_2(-x,-y);} // -Q
+ R_2 operator+()const {return *this;} // +Q
+ R operator,(R_2 P)const {return x*P.x+y*P.y;} // produit scalaire (Q,P)
+ R operator^(R_2 P)const {return x*P.y-y*P.x;} // produit vectoriel Q^P
+ R_2 operator*(R c)const {return R_2(x*c,y*c);} // produit a droite P*c
+ R_2 operator*=(R c) {x *= c; y *= c; return *this;}
+ R_2 operator/(R c)const {return R_2(x/c,y/c);} // division par un reel
+ R_2 operator/=(R c) {x /= c; y /= c; return *this;}
R & operator[](int i) {return (&x)[i];} // la coordonnee i
- R2 orthogonal() {return R2(-y,x);} //le vecteur orthogonal dans R2
- friend R2 operator*(R c,R2 P) {return P*c;} // produit a gauche c*P
+ R_2 orthogonal() {return R_2(-y,x);} //le vecteur orthogonal dans R_2
+ friend R_2 operator*(R c,R_2 P) {return P*c;} // produit a gauche c*P
};
-//la classe R3
+//la classe R_3
//============
-class R3
+class R_3
{
- friend std::ostream& operator << (std::ostream& f, const R3 & P)
+ friend std::ostream& operator << (std::ostream& f, const R_3 & P)
{ f << P.x << ' ' << P.y << ' ' << P.z ; return f; }
- friend std::istream& operator >> (std::istream& f, R3 & P)
+ friend std::istream& operator >> (std::istream& f, R_3 & P)
{ f >> P.x >> P.y >> P.z ; return f; }
- friend std::ostream& operator << (std::ostream& f, const R3 * P)
+ friend std::ostream& operator << (std::ostream& f, const R_3 * P)
{ f << P->x << ' ' << P->y << ' ' << P->z ; return f; }
- friend std::istream& operator >> (std::istream& f, R3 * P)
+ friend std::istream& operator >> (std::istream& f, R_3 * P)
{ f >> P->x >> P->y >> P->z ; return f; }
public:
R x,y,z; //les 3 coordonnees
- R3 () :x(0),y(0),z(0) {} //les constructeurs
- R3 (R a,R b,R c):x(a),y(b),z(c) {} //Point ou Vecteur (a,b,c)
- R3 (R3 A,R3 B):x(B.x-A.x),y(B.y-A.y),z(B.z-A.z) {} //Vecteur AB
-
- R3 (gp_Pnt P) : x(P.X()), y(P.Y()), z(P.Z()) {} //Point d'OpenCascade
- R3 (gp_Vec V) : x(V.X()), y(V.Y()), z(V.Z()) {} //Vecteur d'OpenCascade
- R3 (gp_Dir P) : x(P.X()), y(P.Y()), z(P.Z()) {} //Direction d'OpenCascade
-
- R3 operator+(R3 P)const {return R3(x+P.x,y+P.y,z+P.z);}
- R3 operator+=(R3 P) {x += P.x; y += P.y; z += P.z; return *this;}
- R3 operator-(R3 P)const {return R3(x-P.x,y-P.y,z-P.z);}
- R3 operator-=(R3 P) {x -= P.x; y -= P.y; z -= P.z; return *this;}
- R3 operator-()const {return R3(-x,-y,-z);}
- R3 operator+()const {return *this;}
- R operator,(R3 P)const {return x*P.x+y*P.y+z*P.z;} // produit scalaire
- R3 operator^(R3 P)const {return R3(y*P.z-z*P.y ,P.x*z-x*P.z, x*P.y-y*P.x);} // produit vectoriel
- R3 operator*(R c)const {return R3(x*c,y*c,z*c);}
- R3 operator*=(R c) {x *= c; y *= c; z *= c; return *this;}
- R3 operator/(R c)const {return R3(x/c,y/c,z/c);}
- R3 operator/=(R c) {x /= c; y /= c; z /= c; return *this;}
+ R_3 () :x(0),y(0),z(0) {} //les constructeurs
+ R_3 (R a,R b,R c):x(a),y(b),z(c) {} //Point ou Vecteur (a,b,c)
+ R_3 (R_3 A,R_3 B):x(B.x-A.x),y(B.y-A.y),z(B.z-A.z) {} //Vecteur AB
+
+ R_3 (gp_Pnt P) : x(P.X()), y(P.Y()), z(P.Z()) {} //Point d'OpenCascade
+ R_3 (gp_Vec V) : x(V.X()), y(V.Y()), z(V.Z()) {} //Vecteur d'OpenCascade
+ R_3 (gp_Dir P) : x(P.X()), y(P.Y()), z(P.Z()) {} //Direction d'OpenCascade
+
+ R_3 operator+(R_3 P)const {return R_3(x+P.x,y+P.y,z+P.z);}
+ R_3 operator+=(R_3 P) {x += P.x; y += P.y; z += P.z; return *this;}
+ R_3 operator-(R_3 P)const {return R_3(x-P.x,y-P.y,z-P.z);}
+ R_3 operator-=(R_3 P) {x -= P.x; y -= P.y; z -= P.z; return *this;}
+ R_3 operator-()const {return R_3(-x,-y,-z);}
+ R_3 operator+()const {return *this;}
+ R operator,(R_3 P)const {return x*P.x+y*P.y+z*P.z;} // produit scalaire
+ R_3 operator^(R_3 P)const {return R_3(y*P.z-z*P.y ,P.x*z-x*P.z, x*P.y-y*P.x);} // produit vectoriel
+ R_3 operator*(R c)const {return R_3(x*c,y*c,z*c);}
+ R_3 operator*=(R c) {x *= c; y *= c; z *= c; return *this;}
+ R_3 operator/(R c)const {return R_3(x/c,y/c,z/c);}
+ R_3 operator/=(R c) {x /= c; y /= c; z /= c; return *this;}
R & operator[](int i) {return (&x)[i];}
- friend R3 operator*(R c,R3 P) {return P*c;}
+ friend R_3 operator*(R c,R_3 P) {return P*c;}
- R3 operator=(gp_Pnt P) {return R3(P.X(),P.Y(),P.Z());}
- R3 operator=(gp_Dir P) {return R3(P.X(),P.Y(),P.Z());}
+ R_3 operator=(gp_Pnt P) {return R_3(P.X(),P.Y(),P.Z());}
+ R_3 operator=(gp_Dir P) {return R_3(P.X(),P.Y(),P.Z());}
- friend gp_Pnt gp_pnt(R3 xyz) { return gp_Pnt(xyz.x,xyz.y,xyz.z); }
+ friend gp_Pnt gp_pnt(R_3 xyz) { return gp_Pnt(xyz.x,xyz.y,xyz.z); }
//friend gp_Pnt operator=() { return gp_Pnt(x,y,z); }
- friend gp_Dir gp_dir(R3 xyz) { return gp_Dir(xyz.x,xyz.y,xyz.z); }
+ friend gp_Dir gp_dir(R_3 xyz) { return gp_Dir(xyz.x,xyz.y,xyz.z); }
- bool DansPave( R3 & xyzMin, R3 & xyzMax )
+ bool DansPave( R_3 & xyzMin, R_3 & xyzMax )
{ return xyzMin.x<=x && x<=xyzMax.x &&
xyzMin.y<=y && y<=xyzMax.y &&
xyzMin.z<=z && z<=xyzMax.z; }
};
-//la classe R4
+//la classe R_4
//============
-class R4: public R3
+class R_4: public R_3
{
- friend std::ostream& operator <<(std::ostream& f, const R4 & P )
+ friend std::ostream& operator <<(std::ostream& f, const R_4 & P )
{ f << P.x << ' ' << P.y << ' ' << P.z << ' ' << P.omega; return f; }
- friend istream& operator >>(istream& f, R4 & P)
+ friend istream& operator >>(istream& f, R_4 & P)
{ f >> P.x >> P.y >> P.z >> P.omega ; return f; }
- friend std::ostream& operator <<(std::ostream& f, const R4 * P )
+ friend std::ostream& operator <<(std::ostream& f, const R_4 * P )
{ f << P->x << ' ' << P->y << ' ' << P->z << ' ' << P->omega; return f; }
- friend istream& operator >>(istream& f, R4 * P)
+ friend istream& operator >>(istream& f, R_4 * P)
{ f >> P->x >> P->y >> P->z >> P->omega ; return f; }
public:
R omega; //la donnee du poids supplementaire
- R4 () :omega(1.0) {} //les constructeurs
- R4 (R a,R b,R c,R d):R3(a,b,c),omega(d) {}
- R4 (R4 A,R4 B) :R3(B.x-A.x,B.y-A.y,B.z-A.z),omega(B.omega-A.omega) {}
-
- R4 operator+(R4 P)const {return R4(x+P.x,y+P.y,z+P.z,omega+P.omega);}
- R4 operator+=(R4 P) {x += P.x;y += P.y;z += P.z;omega += P.omega;return *this;}
- R4 operator-(R4 P)const {return R4(x-P.x,y-P.y,z-P.z,omega-P.omega);}
- R4 operator-=(R4 P) {x -= P.x;y -= P.y;z -= P.z;omega -= P.omega;return *this;}
- R4 operator-()const {return R4(-x,-y,-z,-omega);}
- R4 operator+()const {return *this;}
- R operator,(R4 P)const {return x*P.x+y*P.y+z*P.z+omega*P.omega;} // produit scalaire
- R4 operator*(R c)const {return R4(x*c,y*c,z*c,omega*c);}
- R4 operator*=(R c) {x *= c; y *= c; z *= c; omega *= c; return *this;}
- R4 operator/(R c)const {return R4(x/c,y/c,z/c,omega/c);}
- R4 operator/=(R c) {x /= c; y /= c; z /= c; omega /= c; return *this;}
+ R_4 () :omega(1.0) {} //les constructeurs
+ R_4 (R a,R b,R c,R d):R_3(a,b,c),omega(d) {}
+ R_4 (R_4 A,R_4 B) :R_3(B.x-A.x,B.y-A.y,B.z-A.z),omega(B.omega-A.omega) {}
+
+ R_4 operator+(R_4 P)const {return R_4(x+P.x,y+P.y,z+P.z,omega+P.omega);}
+ R_4 operator+=(R_4 P) {x += P.x;y += P.y;z += P.z;omega += P.omega;return *this;}
+ R_4 operator-(R_4 P)const {return R_4(x-P.x,y-P.y,z-P.z,omega-P.omega);}
+ R_4 operator-=(R_4 P) {x -= P.x;y -= P.y;z -= P.z;omega -= P.omega;return *this;}
+ R_4 operator-()const {return R_4(-x,-y,-z,-omega);}
+ R_4 operator+()const {return *this;}
+ R operator,(R_4 P)const {return x*P.x+y*P.y+z*P.z+omega*P.omega;} // produit scalaire
+ R_4 operator*(R c)const {return R_4(x*c,y*c,z*c,omega*c);}
+ R_4 operator*=(R c) {x *= c; y *= c; z *= c; omega *= c; return *this;}
+ R_4 operator/(R c)const {return R_4(x/c,y/c,z/c,omega/c);}
+ R_4 operator/=(R c) {x /= c; y /= c; z /= c; omega /= c; return *this;}
R & operator[](int i) {return (&x)[i];}
- friend R4 operator*(R c,R4 P) {return P*c;}
+ friend R_4 operator*(R c,R_4 P) {return P*c;}
};
//quelques fonctions supplementaires sur ces classes
//==================================================
-inline R Aire2d(const R2 A,const R2 B,const R2 C){return (B-A)^(C-A);}
-inline R Angle2d(R2 P){ return atan2(P.y,P.x);}
-
-inline R Norme2_2(const R2 & A){ return (A,A);}
-inline R Norme2(const R2 & A){ return sqrt((A,A));}
-inline R NormeInfinie(const R2 & A){return Max(Abs(A.x),Abs(A.y));}
-
-inline R Norme2_2(const R3 & A){ return (A,A);}
-inline R Norme2(const R3 & A){ return sqrt((A,A));}
-inline R NormeInfinie(const R3 & A){return Max(Abs(A.x),Abs(A.y),Abs(A.z));}
-
-inline R Norme2_2(const R4 & A){ return (A,A);}
-inline R Norme2(const R4 & A){ return sqrt((A,A));}
-inline R NormeInfinie(const R4 & A){return Max(Abs(A.x),Abs(A.y),Abs(A.z),Abs(A.omega));}
-
-inline R2 XY(R3 P) {return R2(P.x, P.y);} //restriction a R2 d'un R3 par perte de z
-inline R3 Min(R3 P, R3 Q)
-{return R3(P.x<Q.x ? P.x : Q.x, P.y<Q.y ? P.y : Q.y, P.z<Q.z ? P.z : Q.z);} //Pt de xyz Min
-inline R3 Max(R3 P, R3 Q)
-{return R3(P.x>Q.x ? P.x : Q.x, P.y>Q.y ? P.y : Q.y, P.z>Q.z ? P.z : Q.z);} //Pt de xyz Max
+inline R Aire2d(const R_2 A,const R_2 B,const R_2 C){return (B-A)^(C-A);}
+inline R Angle2d(R_2 P){ return atan2(P.y,P.x);}
+
+inline R Norme2_2(const R_2 & A){ return (A,A);}
+inline R Norme2(const R_2 & A){ return sqrt((A,A));}
+inline R NormeInfinie(const R_2 & A){return Max(Abs(A.x),Abs(A.y));}
+
+inline R Norme2_2(const R_3 & A){ return (A,A);}
+inline R Norme2(const R_3 & A){ return sqrt((A,A));}
+inline R NormeInfinie(const R_3 & A){return Max(Abs(A.x),Abs(A.y),Abs(A.z));}
+
+inline R Norme2_2(const R_4 & A){ return (A,A);}
+inline R Norme2(const R_4 & A){ return sqrt((A,A));}
+inline R NormeInfinie(const R_4 & A){return Max(Abs(A.x),Abs(A.y),Abs(A.z),Abs(A.omega));}
+
+inline R_2 XY(R_3 P) {return R_2(P.x, P.y);} //restriction a R_2 d'un R_3 par perte de z
+inline R_3 Min(R_3 P, R_3 Q)
+{return R_3(P.x<Q.x ? P.x : Q.x, P.y<Q.y ? P.y : Q.y, P.z<Q.z ? P.z : Q.z);} //Pt de xyz Min
+inline R_3 Max(R_3 P, R_3 Q)
+{return R_3(P.x>Q.x ? P.x : Q.x, P.y>Q.y ? P.y : Q.y, P.z>Q.z ? P.z : Q.z);} //Pt de xyz Max
#endif
MEFISTO2D_EXPORT
void aptrte( Z nutysu, R aretmx,
- Z nblf, Z *nudslf, R2 *uvslf,
- Z nbpti, R2 *uvpti,
- Z & nbst, R2 * & uvst, Z & nbt, Z * & nust,
+ Z nblf, Z *nudslf, R_2 *uvslf,
+ Z nbpti, R_2 *uvpti,
+ Z & nbst, R_2 * & uvst, Z & nbt, Z * & nust,
Z & ierr );
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// but : appel de la triangulation par un arbre-4 recouvrant
#define tesuex TESUEX
#define teamqt TEAMQT
#define nusotr NUSOTR
- #define qutr2d QUTR2D
+ #define qutr2d QUTR_2D
#define surtd2 SURTD2
#define qualitetrte QUALITETRTE
__stdcall
#endif
#endif
- qualitetrte( R3 *mnpxyd,
+ qualitetrte( R_3 *mnpxyd,
Z & mosoar, Z & mxsoar, Z *mnsoar,
Z & moartr, Z & mxartr, Z *mnartr,
Z & nbtria, R & quamoy, R & quamin ); }
__stdcall
#endif
#endif
- teajte( Z & mxsomm, Z & nbsomm, R3 * mnpxyd, R3 * comxmi,
+ teajte( Z & mxsomm, Z & nbsomm, R_3 * mnpxyd, R_3 * comxmi,
R & aretmx, Z & mxtree, Z * letree,
Z & ierr );
}
__stdcall
#endif
#endif
- tehote( Z & nutysu, Z & nbarpi, Z & mxsomm, Z & nbsomm, R3 * mnpxyd,
- R3 * comxmi, R & aretmx,
+ tehote( Z & nutysu, Z & nbarpi, Z & mxsomm, Z & nbsomm, R_3 * mnpxyd,
+ R_3 * comxmi, R & aretmx,
Z * letree, Z & mxqueu, Z * mnqueu,
Z & ierr );
}
__stdcall
#endif
#endif
- tetrte( R3 * comxmi, R & aretmx, Z & nbarpi, Z & mxsomm, R3 * mnpxyd,
+ tetrte( R_3 * comxmi, R & aretmx, Z & nbarpi, Z & mxsomm, R_3 * mnpxyd,
Z & mxqueu, Z * mnqueu, Z * mntree,
Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar,
Z & moartr, Z & mxartr, Z & n1artr, Z * mnartr, Z * mnarst,
__stdcall
#endif
#endif
- tedela( R3 * mnpxyd, Z * mnarst,
+ tedela( R_3 * mnpxyd, Z * mnarst,
Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar, Z & na,
Z & moartr, Z & mxartr, Z & n1artr, Z * mnartr, Z & n );
}
__stdcall
#endif
#endif
- terefr( Z & nbarpi, R3 * mnpxyd,
+ terefr( Z & nbarpi, R_3 * mnpxyd,
Z & mosoar, Z & mxsoar, Z & n1soar, Z * mnsoar,
Z & moartr, Z & mxartr, Z & n1artr, Z * mnartr, Z * mnarst,
Z & mxarcf, Z * mnarc1, Z * mnarc2,
#endif
#endif
tesuex( Z & nblf, Z * nulftr,
- Z & ndtri0, Z & nbsomm, R3 * mnpxyd, Z * mnslig,
+ Z & ndtri0, Z & nbsomm, R_3 * mnpxyd, Z * mnslig,
Z & mosoar, Z & mxsoar, Z * mnsoar,
Z & moartr, Z & mxartr, Z & n1artr, Z * mnartr, Z * mnarst,
Z & nbtria, Z * mntrsu, Z & ierr );
Z & mxarcf, Z * mntrcf, Z * mnstbo,
Z * n1arcf, Z * mnarcf, Z * mnarc1,
Z & nbarpi, Z & nbsomm, Z & mxsomm,
- R3 * mnpxyd, Z * mnslig,
+ R_3 * mnpxyd, Z * mnslig,
Z & ierr );
}
// amelioration de la qualite de la triangulation par
__stdcall
#endif
#endif
- qutr2d( R3 & p1, R3 & p2, R3 & p3, R & qualite );
+ qutr2d( R_3 & p1, R_3 & p2, R_3 & p3, R & qualite );
}
//calculer la qualite d'un triangle de R2 de sommets p1, p2, p3
__stdcall
#endif
#endif
- surtd2( R3 & p1, R3 & p2, R3 & p3 );
+ surtd2( R_3 & p1, R_3 & p2, R_3 & p3 );
}
//calcul de la surface d'un triangle defini par 3 points de r**2