ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/mailleur/src/dly_triangle.cpp
Revision: 1158
Committed: Thu Jun 13 22:18:49 2024 UTC (11 months ago) by francois
File size: 2885 byte(s)
Log Message:
compatibilité Ubuntu 22.04
Suppression des refeences à Windows
Ajout d'une banière

File Contents

# User Rev Content
1 francois 1158 //####//------------------------------------------------------------
2     //####//------------------------------------------------------------
3     //####// MAGiC
4     //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5     //####// Departement de Genie Mecanique - UQTR
6     //####//------------------------------------------------------------
7     //####// MAGIC est un projet de recherche de l equipe ERICCA
8     //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9     //####// http://www.uqtr.ca/ericca
10     //####// http://www.uqtr.ca/
11     //####//------------------------------------------------------------
12     //####//------------------------------------------------------------
13     //####//
14     //####// dly_triangle.cpp
15     //####//
16     //####//------------------------------------------------------------
17     //####//------------------------------------------------------------
18     //####// COPYRIGHT 2000-2024
19     //####// jeu 13 jun 2024 11:58:55 EDT
20     //####//------------------------------------------------------------
21     //####//------------------------------------------------------------
22 francois 285
23    
24     #include "gestionversion.h"
25 francois 313 #include <stdlib.h>
26 francois 285
27     #include "dly_noeud.h"
28     #include "dly_triangle.h"
29     #include "dly_tetra.h"
30     #include "ot_mathematique.h"
31     #include <math.h>
32    
33    
34    
35     DLY_TRIANGLE::DLY_TRIANGLE(class DLY_NOEUD *no1,class DLY_NOEUD *no2,class DLY_NOEUD *no3):noeud1(no1),noeud2(no2),noeud3(no3),frontiere(-1)
36     {
37     }
38     DLY_TRIANGLE::DLY_TRIANGLE(DLY_TRIANGLE& mdd):noeud1(mdd.noeud1),noeud2(mdd.noeud2),noeud3(mdd.noeud3),frontiere(mdd.frontiere)
39     {
40     }
41     DLY_TRIANGLE::~DLY_TRIANGLE()
42     {
43     }
44    
45     DLY_NOEUD* DLY_TRIANGLE::get_noeud1(void)
46     {
47     return noeud1;
48     }
49     DLY_NOEUD* DLY_TRIANGLE::get_noeud2(void)
50     {
51     return noeud2;
52     }
53     DLY_NOEUD* DLY_TRIANGLE::get_noeud3(void)
54     {
55     return noeud3;
56     }
57    
58     void DLY_TRIANGLE::insere_lien_tetra(DLY_TETRA* tet)
59     {
60     lsttet.push_back(tet);
61     }
62    
63    
64     int DLY_TRIANGLE::tet_est_present(DLY_TETRA* tet)
65     {
66     for (std::vector<DLY_TETRA*>::iterator it=lsttet.begin();it!=lsttet.end();it++)
67     if ((*it)==tet) return 1;return 0;
68     }
69    
70     int DLY_TRIANGLE::get_nb_tetra(void)
71     {
72     return lsttet.size();
73     }
74    
75     DLY_TETRA* DLY_TRIANGLE::get_tetra(int i)
76     {
77     return lsttet[i];
78     }
79    
80     int DLY_TRIANGLE::est_coplanaire(double x,double y, double z)
81     {
82     double xyz1[3],xyz2[3],xyz3[3];
83     noeud1->get_coord(xyz1);
84     noeud2->get_coord(xyz2);
85     noeud3->get_coord(xyz3);
86     double xyz[3]={x,y,z};
87     OT_VECTEUR_3D vec1(xyz1,xyz2);
88     OT_VECTEUR_3D vec2(xyz1,xyz3);
89     OT_VECTEUR_3D n=vec1&vec2;
90     OT_VECTEUR_3D vec(xyz1,xyz);
91     n.norme();
92     vec.norme();
93     double ps=n*vec;
94     int resultat=0;
95     if (fabs(ps)<0.0000000001) resultat=1;
96     return resultat;
97     }
98    
99     int DLY_TRIANGLE::est_frontiere(void )
100     {
101     if (frontiere==-1)
102     {
103     int nbtetra=0;
104     for (int j=0;j<lsttet.size();j++)
105     if ((lsttet[j])->get_feuille()==1) nbtetra++;
106     if (nbtetra==1) frontiere=1; else frontiere=0;
107     }
108     return frontiere;
109     }