1 |
francois |
285 |
//------------------------------------------------------------
|
2 |
|
|
//------------------------------------------------------------
|
3 |
|
|
// MAGiC
|
4 |
|
|
// Jean Christophe Cuilli�re et Vincent FRANCOIS
|
5 |
|
|
// D�partement de G�nie M�canique - UQTR
|
6 |
|
|
//------------------------------------------------------------
|
7 |
|
|
// Le projet MAGIC est un projet de recherche du d�partement
|
8 |
|
|
// de g�nie m�canique de l'Universit� du Qu�bec �
|
9 |
|
|
// Trois Rivi�res
|
10 |
|
|
// Les librairies ne peuvent �tre utilis�es sans l'accord
|
11 |
|
|
// des auteurs (contact : francois@uqtr.ca)
|
12 |
|
|
//------------------------------------------------------------
|
13 |
|
|
//------------------------------------------------------------
|
14 |
|
|
//
|
15 |
|
|
// m3d_noeud.cpp
|
16 |
|
|
//
|
17 |
|
|
//------------------------------------------------------------
|
18 |
|
|
//------------------------------------------------------------
|
19 |
|
|
// COPYRIGHT 2000
|
20 |
|
|
// Version du 02/03/2006 � 11H23
|
21 |
|
|
//------------------------------------------------------------
|
22 |
|
|
//------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h"
|
26 |
|
|
|
27 |
|
|
//#pragma hdrstop
|
28 |
|
|
|
29 |
|
|
#include "dly_noeud.h"
|
30 |
|
|
#include "dly_triangle.h"
|
31 |
|
|
#include "dly_tetra.h"
|
32 |
|
|
#include "ot_mathematique.h"
|
33 |
|
|
#include <math.h>
|
34 |
|
|
//---------------------------------------------------------------------------
|
35 |
|
|
|
36 |
|
|
//#pragma package(smart_init)
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
DLY_TRIANGLE::DLY_TRIANGLE(class DLY_NOEUD *no1,class DLY_NOEUD *no2,class DLY_NOEUD *no3):noeud1(no1),noeud2(no2),noeud3(no3),frontiere(-1)
|
40 |
|
|
{
|
41 |
|
|
}
|
42 |
|
|
DLY_TRIANGLE::DLY_TRIANGLE(DLY_TRIANGLE& mdd):noeud1(mdd.noeud1),noeud2(mdd.noeud2),noeud3(mdd.noeud3),frontiere(mdd.frontiere)
|
43 |
|
|
{
|
44 |
|
|
}
|
45 |
|
|
DLY_TRIANGLE::~DLY_TRIANGLE()
|
46 |
|
|
{
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
DLY_NOEUD* DLY_TRIANGLE::get_noeud1(void)
|
50 |
|
|
{
|
51 |
|
|
return noeud1;
|
52 |
|
|
}
|
53 |
|
|
DLY_NOEUD* DLY_TRIANGLE::get_noeud2(void)
|
54 |
|
|
{
|
55 |
|
|
return noeud2;
|
56 |
|
|
}
|
57 |
|
|
DLY_NOEUD* DLY_TRIANGLE::get_noeud3(void)
|
58 |
|
|
{
|
59 |
|
|
return noeud3;
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
void DLY_TRIANGLE::insere_lien_tetra(DLY_TETRA* tet)
|
63 |
|
|
{
|
64 |
|
|
lsttet.push_back(tet);
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
int DLY_TRIANGLE::tet_est_present(DLY_TETRA* tet)
|
69 |
|
|
{
|
70 |
|
|
for (std::vector<DLY_TETRA*>::iterator it=lsttet.begin();it!=lsttet.end();it++)
|
71 |
|
|
if ((*it)==tet) return 1;return 0;
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
int DLY_TRIANGLE::get_nb_tetra(void)
|
75 |
|
|
{
|
76 |
|
|
return lsttet.size();
|
77 |
|
|
}
|
78 |
|
|
|
79 |
|
|
DLY_TETRA* DLY_TRIANGLE::get_tetra(int i)
|
80 |
|
|
{
|
81 |
|
|
return lsttet[i];
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
int DLY_TRIANGLE::est_coplanaire(double x,double y, double z)
|
85 |
|
|
{
|
86 |
|
|
double xyz1[3],xyz2[3],xyz3[3];
|
87 |
|
|
noeud1->get_coord(xyz1);
|
88 |
|
|
noeud2->get_coord(xyz2);
|
89 |
|
|
noeud3->get_coord(xyz3);
|
90 |
|
|
double xyz[3]={x,y,z};
|
91 |
|
|
OT_VECTEUR_3D vec1(xyz1,xyz2);
|
92 |
|
|
OT_VECTEUR_3D vec2(xyz1,xyz3);
|
93 |
|
|
OT_VECTEUR_3D n=vec1&vec2;
|
94 |
|
|
OT_VECTEUR_3D vec(xyz1,xyz);
|
95 |
|
|
n.norme();
|
96 |
|
|
vec.norme();
|
97 |
|
|
double ps=n*vec;
|
98 |
|
|
int resultat=0;
|
99 |
|
|
if (fabs(ps)<0.0000000001) resultat=1;
|
100 |
|
|
return resultat;
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
int DLY_TRIANGLE::est_frontiere(void )
|
104 |
|
|
{
|
105 |
|
|
if (frontiere==-1)
|
106 |
|
|
{
|
107 |
|
|
int nbtetra=0;
|
108 |
|
|
for (int j=0;j<lsttet.size();j++)
|
109 |
|
|
if ((lsttet[j])->get_feuille()==1) nbtetra++;
|
110 |
|
|
if (nbtetra==1) frontiere=1; else frontiere=0;
|
111 |
|
|
}
|
112 |
|
|
return frontiere;
|
113 |
|
|
}
|