 |
MAGiC
V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
|
Aller à la documentation de ce fichier.
62 std::map<long,double>::iterator it;
117 std::map<long,double>::iterator it;
123 else it->second+=val;
135 std::map<long,double>::iterator it;
238 ofstr.write((
char*)&
m_init,
sizeof(
bool));
239 ofstr.write((
char*)&
m_i_min,
sizeof(
long));
240 ofstr.write((
char*)&
m_i_max,
sizeof(
long));
243 ofstr.write((
char*)&nb_colonne,
sizeof(
long));
244 std::map<long,double>::iterator it;
248 ofstr.write((
char*)&i,
sizeof(
long));
249 double val = it->second;
250 ofstr.write((
char*)&val,
sizeof(
double));
256 ifstr.read((
char*)&
m_init,
sizeof(
bool));
257 ifstr.read((
char*)&
m_i_min,
sizeof(
long));
258 ifstr.read((
char*)&
m_i_max,
sizeof(
long));
261 ifstr.read((
char*)&nb_colonne,
sizeof(
long));
262 for(
long j=0;j<nb_colonne;j++)
265 ifstr.read((
char*)&k,
sizeof(
long));
267 ifstr.read((
char*)&val,
sizeof(
double));
274 FILE* in=fopen(nom_fichier,
"rt");
276 char *
res=fgets(ligne,1000,in);
277 res=fgets(ligne,1000,in);
278 double xmin,xmax,xmilieu,val;
281 sscanf(ligne,
"%lf %lf %lf %lf",&xmin,&xmax,&xmilieu,&val);
287 res=fgets(ligne,1000,in);
293 ofstrm <<
"x_min x_max x_milieu valeur" << std::endl;
294 std::map<long,double>::iterator it_his;
296 double borne_min,borne_max;
301 ofstrm << borne_min <<
" " << borne_max <<
" " << borne_mid <<
" " << val << std::endl;
398 valeur[0]=xyz2[0]-xyz1[0];
399 valeur[1]=xyz2[1]-xyz1[1];
400 valeur[2]=xyz2[2]-xyz1[2];
454 OT_VECTEUR_3D::operator
const double* ()
const
459 OT_VECTEUR_3D::operator
double* ()
508 double alpha=(*this)*vint;
558 __os <<
"{ "<< __vec[0]<<
", "<<__vec[1]<<
", "<<__vec[2]<<
"}, ";
566 if ( diviseur != (
double)0.0 )
568 double facteur = ((double)1.0)/diviseur;
630 if ( diviseur != (
double)0.0 )
632 double facteur = ((double)1.0)/diviseur;
678 for (
int i=0;i<3;i++)
680 for (
int j=0;j<3;j++)
692 for (
unsigned i=0; i<3; i++)
694 __os <<
"[ "<< __mat(i,0)<<
" ]\t [ "<<__mat(i,1) <<
" ]\t [ "<<__mat(i,2);
696 __os << std::endl <<
" ";
698 __os <<
" }" << std::endl;
709 for (
int i=0;i<3;i++)
711 for (
int j=0;j<3;j++)
721 return vec[iCol][iLigne];
725 return vec[iCol][iLigne];
729 return vec[iCol][iLigne];
733 return vec[iCol][iLigne];
740 double determinant =
valeur(0,0)*coFacteur0 +
valeur(0,1)*coFacteur1 +
valeur(0,2)*coFacteur2;
745 for (
unsigned i = 0; i<3; i++)
746 for (
unsigned j = 0; j < 3; j++)
747 vec[i][j] = (i==j) ? 1.0 : 0.0 ;
752 for (
unsigned i = 0; i<3; i++)
753 for (
unsigned j = 0; j < 3; j++)
754 res.vec[i][j] =
vec[j][i];
760 for (
unsigned i = 0; i<3; i++)
761 for (
unsigned j = 0; j < 3; j++)
784 double det =
valeur(0,0)*matInverse(0,0) +
valeur(0,1)*matInverse(1,0)+
785 valeur(0,2)*matInverse(2,0);
787 if ( fabs(det) <= 1E-100 )
793 double invDet = 1/det;
795 for (
int i=0; i<3; i++)
796 for (
int j=0; j<3; j++)
797 matInverse.
vec[i][j] *= invDet;
832 for (
int i=0;i<3;i++) {
833 for (
int j=0;j<3;j++) tmp(i,j)= mdd1(i,j)+mdd2(i,j);
842 tmp(0)=mdd1(0,0)*mdd2(0)+mdd1(0,1)*mdd2(1)+mdd1(0,2)*mdd2(2);
843 tmp(1)=mdd1(1,0)*mdd2(0)+mdd1(1,1)*mdd2(1)+mdd1(1,2)*mdd2(2);
844 tmp(2)=mdd1(2,0)*mdd2(0)+mdd1(2,1)*mdd2(1)+mdd1(2,2)*mdd2(2);
851 tmp(0)=mdd1(0)+mdd2(0);
852 tmp(1)=mdd1(1)+mdd2(1);
853 tmp(2)=mdd1(2)+mdd2(2);
869 for (
int i=0; i<3; i++)
870 for (
int j=0; j<3; j++)
873 for (
int k=0; k<3; k++)
874 tmp(i,j) += mdd1(i,k)*mdd2(k,j);
882 for (
int i=0; i<4; i++)
896 valeur[0]=xyz2[0]-xyz1[0];
897 valeur[1]=xyz2[1]-xyz1[1];
898 valeur[2]=xyz2[2]-xyz1[2];
899 valeur[3]=xyz2[3]-xyz1[3];
904 for (
int i=0; i<4; i++)
929 OT_VECTEUR_4D::operator
const double* ()
const
934 OT_VECTEUR_4D::operator
double* ()
1009 a*rkV[0],
a*rkV[1],
a*rkV[2],
a*rkV[3]
1015 a*rkV[0],
a*rkV[1],
a*rkV[2],
a*rkV[3]
1023 inv*rkV[0],inv*rkV[1],inv*rkV[2],inv*rkV[3]
1032 inv*rkV[0],inv*rkV[1],inv*rkV[2],inv*rkV[3]
1069 double a = 1/fScalar;
1084 __os <<
"{ "<< __vec[0]<<
", "<<__vec[1]<<
", "<<__vec[2]<<
", "<<__vec[3]<<
"}, ";
1087 #endif // ot_vecteur_4d
1096 for (
int i=0; i<3; i++)
1109 valeur[0]=xyz2[0]-xyz1[0];
1110 valeur[1]=xyz2[1]-xyz1[1];
1111 valeur[2]=xyz2[2]-xyz1[2];
1116 for (
int i=0; i<3; i++)
1153 if (
this==&v3d)
return *
this;
1170 nor=(*this)*(1./
norme);
1239 a*rkV[0],
a*rkV[1],
a*rkV[2]);
1244 a*rkV[0],
a*rkV[1],
a*rkV[2]);
1251 inv*rkV[0],inv*rkV[1],inv*rkV[2]);
1259 inv*rkV[0],inv*rkV[1],inv*rkV[2]);
1309 __os <<
"[ "<<std::setw(20)<< __vec[0]<<std::setw(4)<<
", "<<std::setw(20)<<__vec[1]<<
", "<<std::setw(20)<<__vec[2]<<std::setw(4)<<
", "<<std::setw(20)<<
"] ";
1337 for (
int i=0; i<4; i++)
1351 for (
int i=0; i<4; i++)
1388 if (
this==&v4d)
return *
this;
1406 assert(
norme!=zero) ;
1407 nor=(*this)*(1./
norme);
1417 assert(
norme!=zero) ;
1494 a*rkV[0],
a*rkV[1],
a*rkV[2],
a*rkV[3]
1500 a*rkV[0],
a*rkV[1],
a*rkV[2],
a*rkV[3]
1508 inv*rkV[0],inv*rkV[1],inv*rkV[2],inv*rkV[3]
1517 inv*rkV[0],inv*rkV[1],inv*rkV[2],inv*rkV[3]
1574 __os <<
"[ "<<std::setw(20)<< __vec[0]<<std::setw(4)<<
", "<<std::setw(20)<<__vec[1]<<
", "<<std::setw(20)<<__vec[2]<<std::setw(4)<<
", "<<std::setw(20)<<__vec[3]<<std::setw(4)<<
"] ";
1631 double res=fabs(
a-b);
1632 if (
res<eps)
return(1);
1638 if(fabs(xyz1[0]-xyz2[0])<eps)
1639 if(fabs(xyz1[1]-xyz2[1])<eps)
1640 if(fabs(xyz1[2]-xyz2[2])<eps)
1655 double dmax=std::max(d12,d13);
1656 dmax=std::max(dmax,d23);
1657 double p=0.5*(d12+d13+d23);
1658 double crit=(p-d12)*(p-d13)*(p-d23)/p;
1659 if (crit<0) crit=0.;
1662 crit=crit*3.4641101614;
1668 int *p=(
int*)(&(val));
1688 double dmax=std::max(dab,dac);
1689 dmax=std::max(dmax,dcb);
1690 dmax=std::max(dmax,ddb);
1691 dmax=std::max(dmax,dda);
1692 dmax=std::max(dmax,ddc);
1696 if (vol>0.)
return 0.;
1705 double crit=vol/som/dmax/0.408249;
1711 OT_VECTEUR_3D v1(xyz2[0]-xyz1[0],xyz2[1]-xyz1[1],xyz2[2]-xyz1[2]);
1712 OT_VECTEUR_3D v2(xyz3[0]-xyz1[0],xyz3[1]-xyz1[1],xyz3[2]-xyz1[2]);
1713 OT_VECTEUR_3D v3(xyz4[0]-xyz1[0],xyz4[1]-xyz1[1],xyz4[2]-xyz1[2]);
1719 double det=
mat.get_determinant();
1720 double xsi=
mat1.get_determinant()/det;
1721 double eta=
mat2.get_determinant()/det;
1725 double eps=0.0000001;
1726 if (xsi<-eps) reponse1=0;
1727 if (eta<-eps) reponse1=0;
1728 if (dseta<-eps) reponse1=0;
1729 if (xsi+eta+dseta>1.+eps) reponse1=0;
1730 if (xsi<eps) reponse2=0;
1731 if (eta<eps) reponse2=0;
1732 if (dseta<eps) reponse2=0;
1733 if (xsi+eta+dseta>1.-eps) reponse2=0;
1734 int face1=0,face2=0,face3=0,face4=0;
1735 if ((reponse1==1) && (reponse2==0))
1737 if (dseta<eps) face1=1;
1738 if (eta<eps) face2=1;
1739 if (xsi<eps) face3=1;
1740 if (xsi+eta+dseta>1.-eps) face4=1;
1742 return reponse1+2*reponse2+4*face1+8*face2+16*face3+32*face4;
1768 if ((eta<0.) && (xsi<0.) ) {eta=0;xsi=0.;}
1769 if ((eta<0.) && (xsi>0.) && (xsi<1.) ) eta=0;
1770 if ((xsi<0.) && (eta>0.) && (eta<1.) ) xsi=0;
1771 if ((xsi>1.) && (eta<0.) ) {eta=0;xsi=1.;}
1772 if ((xsi<0.) && (eta>1.) ) {eta=1.;xsi=0.;}
1773 if ((eta>0.) && (xsi>0.) && (eta+xsi>1.))
1775 double diff=eta+xsi-1.;
1778 if (eta<0.) {xsi=1.;eta=0.;}
1779 if (xsi<0.) {xsi=0.;eta=1.;}
1782 xx=(1.-eta-xsi)*xyz1[0]+xsi*xyz2[0]+eta*xyz3[0];
1783 yy=(1.-eta-xsi)*xyz1[1]+xsi*xyz2[1]+eta*xyz3[1];
1784 zz=(1.-eta-xsi)*xyz1[2]+xsi*xyz2[2]+eta*xyz3[2];
1797 double det=
m.get_determinant();
1808 double eps=0.0000001;
1809 if (xsi<-eps) reponse1=0;
1810 if (eta<-eps) reponse1=0;
1811 if (xsi+eta>1.+eps) reponse1=0;
1812 if (xsi<eps) reponse2=0;
1813 if (eta<eps) reponse2=0;
1814 if (xsi+eta>1.-eps) reponse2=0;
1815 int arete1=0,arete2=0,arete3=0;
1816 if ((reponse1==1) && (reponse2==0))
1818 if (eta<eps) arete1=1;
1819 if (xsi<eps) arete3=1;
1820 if (xsi+eta>1.-eps) arete2=1;
1822 return reponse1+2*reponse2+4*arete1+8*arete2+16*arete3;
1830 int faceinte=etat&1;
1831 int inte=(etat&2)>>1;
1832 int face1=(etat&4)>>2;
1833 int face2=(etat&8)>>3;
1834 int face3=(etat&16)>>4;
1835 int face4=(etat&32)>>5;
1836 if ((faceinte==1) && (valeur==
INTERIEUR))
return 1;
1837 if ((inte==1) && (valeur==
INTERIEUR))
return 1;
1839 if ((faceinte==1) && (inte==0) && (valeur==
SUR_FACE))
return 1;
1840 if ((face1==1) && (valeur==
FACE1))
return 1;
1841 if ((face2==1) && (valeur==
FACE2))
return 1;
1842 if ((face3==1) && (valeur==
FACE3))
return 1;
1843 if ((face4==1) && (valeur==
FACE4))
return 1;
1844 if ((face1==1) && (face2==1) && (valeur==
ARETE1))
return 1;
1845 if ((face1==1) && (face3==1) && (valeur==
ARETE2))
return 1;
1846 if ((face2==1) && (face3==1) && (valeur==
ARETE3))
return 1;
1847 if ((face1==1) && (face4==1) && (valeur==
ARETE4))
return 1;
1848 if ((face2==1) && (face4==1) && (valeur==
ARETE5))
return 1;
1849 if ((face3==1) && (face4==1) && (valeur==
ARETE6))
return 1;
1850 if ((face1==1) && (face2==1) && (face3==1) && (valeur==
SOMMET1))
return 1;
1851 if ((face1==1) && (face2==1) && (face4==1) && (valeur==
SOMMET2))
return 1;
1852 if ((face1==1) && (face3==1) && (face4==1) && (valeur==
SOMMET3))
return 1;
1853 if ((face2==1) && (face3==1) && (face4==1) && (valeur==
SOMMET4))
return 1;
1859 int areteinte=etat&1;
1860 int inte=(etat&2)>>1;
1861 int arete1=(etat&4)>>2;
1862 int arete2=(etat&8)>>3;
1863 int arete3=(etat&16)>>4;
1864 if ((areteinte==1) && (valeur==
INTERIEUR))
return 1;
1865 if ((inte==1) && (valeur==
INTERIEUR))
return 1;
1867 if ((areteinte==1) && (inte==0) && (valeur==
SUR_ARETE))
return 1;
1868 if ((arete1==1) && (valeur==
ARETE1))
return 1;
1869 if ((arete2==1) && (valeur==
ARETE2))
return 1;
1870 if ((arete3==1) && (valeur==
ARETE3))
return 1;
1871 if ((arete1==1) && (arete2==1) && (valeur==
SOMMET2))
return 1;
1872 if ((arete2==1) && (arete3==1) && (valeur==
SOMMET3))
return 1;
1873 if ((arete3==1) && (arete1==1) && (valeur==
SOMMET1))
return 1;
1891 double dmax=std::max(dab,dac);
1892 dmax=std::max(dmax,dcb);
1893 dmax=std::max(dmax,ddb);
1894 dmax=std::max(dmax,dda);
1895 dmax=std::max(dmax,ddc);
1907 double dmax=std::max(d12,d13);
1908 dmax=std::max(dmax,d23);
1920 for (
int i=0;i<N;i++)
1926 for (
int i=0;i<N;i++)
1946 for (
int i=0;i<N;i++)
1953 for (
int i=0;i<N;i++)
OT_VECTEUR_3D & operator-=(const OT_VECTEUR_3D &rkV)
OT_VECTEUR_3DD operator+(const OT_VECTEUR_3DD &rkV)
virtual double get_w(void) const
virtual double get_x(void) const
OT_VECTEUR_4D & operator/=(double fScalar)
OT_VECTEUR_4DD vecteur_norme_3d()
virtual void change_z(double z)
void ajouter_valeur(double x, double val)
virtual void change_x(double2 x)
OT_VECTEUR_3D operator-(const OT_VECTEUR_3D &mdd1)
void change_vecteur3(OT_VECTEUR_3D v)
virtual void change_y(double2 y)
OT_VECTEUR_3DD vecteur_norme()
double operator*(const OT_VECTEUR_3D &mdd1, const OT_VECTEUR_3D &mdd2)
OT_QUATERNION & operator=(OT_QUATERNION &mdd)
OT_VECTEUR_4DD & operator=(const OT_VECTEUR_4DD &)
OT_VECTEUR_3DD operator-(const OT_VECTEUR_3DD &rkV)
OT_VECTEUR_4DD & operator*=(double2 fScalar)
bool operator==(const OT_VECTEUR_3DD &mdd) const
long get_nb_colonne(void)
double2 operator[](int i) const
double valeur(int iLigne, int iCol) const
virtual double2 & x(void)
OT_VECTEUR_3D & operator/=(double fScalar)
virtual double get_longueur2(void) const
OT_VECTEUR_3D & operator[](int i)
virtual void change_w(double2 w)
static int projeteestdansletriangle(double *xyz1, double *xyz2, double *xyz3, double x, double y, double z)
int compare_valeur(const OT_VECTEUR_3D &mdd) const
std::map< long, double, std::less< long > > m_map_colonne
OT_VECTEUR_3D unite(int i)
virtual void change_y(double y)
virtual double2 get_longueur2(void)
OT_VECTEUR_3D & operator+=(const OT_VECTEUR_3D &rkV)
bool operator==(const OT_VECTEUR_3D &mdd) const
virtual double2 get_w(void) const
static int compare_etat_triangle(int etat, int valeur)
static void calculeparamEFdansletriangle(double *xyz1, double *xyz2, double *xyz3, double x, double y, double z, double &xsi, double &eta)
static int estdansletetra(double *xyz1, double *xyz2, double *xyz3, double *xyz4, double x, double y, double z)
std::ostream & operator<<(std::ostream &__os, const OT_VECTEUR_3D &__vec)
virtual double2 get_longueur(void)
OT_VECTEUR_3D & get_vecteur1(void)
virtual double get_x(void) const
virtual double2 & w(void)
double2 operator[](int i) const
static void projetedansletriangle(double *xyz1, double *xyz2, double *xyz3, double x, double y, double z, double &xx, double &yy, double &zz)
OT_VECTEUR_3DD & operator*=(double2 fScalar)
bool operator>=(const OT_VECTEUR_3D &mdd) const
int get_valeur(double x, double &val)
virtual double2 & z(void)
double operator()(int iLigne, int iCol) const
OT_VECTEUR_4DD & operator/=(double2 fScalar)
virtual void change_z(double z)
OT_VECTEUR_4D operator-(const OT_VECTEUR_4D &rkV)
static int compare_etat_tetra(int etat, int valeur)
int compare_valeur(const OT_VECTEUR_4DD &mdd) const
void enregistrer_bin(std::ofstream &ofstr)
OT_VECTEUR_3D operator&(const OT_VECTEUR_3D &mdd1, const OT_VECTEUR_3D &mdd2)
OT_VECTEUR_4DD operator^(const OT_VECTEUR_4DD &v2)
double operator[](int i) const
virtual double get_longueur(void) const
virtual void change_y(double y)
virtual double2 get_y(void) const
virtual double2 get_z(void) const
virtual double2 get_z(void) const
virtual double2 & y(void)
virtual double2 get_x(void) const
static int egal(double a, double b, double eps)
OT_VECTEUR_4D & operator*=(double fScalar)
virtual double2 & y(void)
virtual double * get_xyz(void)
bool operator<=(const OT_VECTEUR_3D &mdd) const
bool operator==(const OT_VECTEUR_4DD &mdd) const
OT_VECTEUR_3D & get_vecteur3(void)
void exporter(std::ofstream &ofstrm)
OT_VECTEUR_4D operator+(const OT_VECTEUR_4D &rkV)
OT_VECTEUR_4DD & operator-=(const OT_VECTEUR_4DD &rkV)
void change_vecteur2(OT_VECTEUR_3D v)
bool operator>(const OT_VECTEUR_3D &mdd) const
virtual double get_y(void) const
double operator*(const OT_VECTEUR_4D &a)
void ouvrir_txt(char *nom_fichier)
virtual double * get_xyzw(void)
virtual double2 get_x(void) const
virtual void change_x(double x)
OT_MATRICE_3D transpose() const
DOUBLEN< N > & operator=(DOUBLEN< N > &mdd)
OT_HISTOGRAMME & operator=(OT_HISTOGRAMME &mdd)
OT_VECTEUR_3DD & operator-=(const OT_VECTEUR_3DD &rkV)
static double qualite_tetra(double *noeud1, double *noeud2, double *noeud3, double *noeud4)
OT_VECTEUR_3DD & operator=(const OT_VECTEUR_3DD &)
virtual double get_y(void) const
virtual double get_z(void) const
int compare_valeur(const OT_VECTEUR_3DD &mdd) const
OT_VECTEUR_4DD operator-(const OT_VECTEUR_4DD &rkV)
static double taille_triangle(double *noeud1, double *noeud2, double *noeud3)
double get_valeur(int num)
virtual double2 * get_xyzw(void)
bool operator<(const OT_VECTEUR_3D &mdd) const
virtual void change_z(double2 z)
static void doubleto2int(double val, int &val1, int &val2)
virtual double2 * get_xyz(void)
double2 operator*(const OT_VECTEUR_4DD &a)
OT_VECTEUR_4DD operator+(const OT_VECTEUR_4DD &rkV)
int get_premiere_valeur(std::map< long, double >::iterator &it, double &valeur)
double2 sqrt(double2 &val)
OT_VECTEUR_3D operator/(const OT_VECTEUR_3D &mdd1, double diviseur)
OT_VECTEUR_4D & operator-=(const OT_VECTEUR_4D &rkV)
OT_VECTEUR_3D & operator*=(double fScalar)
void ouvrir_bin(std::ifstream &ifstr)
double2 operator*(const OT_VECTEUR_3DD &a)
virtual double2 get_y(void) const
OT_VECTEUR_3D & get_vecteur2(void)
void change_valeur(int num, double val)
static double qualite_triangle(double *noeud1, double *noeud2, double *noeud3)
virtual double get_z(void) const
virtual double diff(void)
static int estdansletriangle(double *xyz1, double *xyz2, double *xyz3, double x, double y, double z)
virtual double get_longueur(void) const
OT_VECTEUR_4DD & operator+=(const OT_VECTEUR_4DD &rkV)
virtual void change_z(double2 z)
OT_VECTEUR_3D gram_shmidt(const OT_VECTEUR_3D &vint)
double operator()(int i) const
virtual double get_longueur2(void) const
virtual void change_x(double2 x)
double operator[](int i) const
OT_MATRICE_3D inverse() const
OT_VECTEUR_3DD & operator/=(double2 fScalar)
OT_VECTEUR_3DD operator&(const OT_VECTEUR_3DD &v2)
virtual void change_w(double w)
double get_largeur_colonne(void)
double operator()(int i) const
OT_VECTEUR_3DD & operator+=(const OT_VECTEUR_3DD &rkV)
void fixe_largeur_colonne(double largeur_colonne)
int get_suivante_valeur(std::map< long, double >::iterator &it, double &valeur)
bool operator!=(const OT_VECTEUR_3D &mdd) const
virtual void change_y(double2 y)
virtual double2 & x(void)
OT_VECTEUR_4DD vecteur_norme()
double2 operator()(int i) const
void change_vecteur1(OT_VECTEUR_3D v)
virtual void change_x(double x)
double2 operator()(int i) const
virtual double2 & z(void)
static double taille_tetra(double *noeud1, double *noeud2, double *noeud3, double *noeud4)
OT_VECTEUR_4D & operator+=(const OT_VECTEUR_4D &rkV)
OT_MATRICE_3D operator+(const OT_MATRICE_3D &mdd1, const OT_MATRICE_3D &mdd2)
OT_VECTEUR_4D & operator=(double)