Salome HOME
This commit was generated by cvs2git to create branch 'IMPORT'.
[modules/smesh.git] / src / SMDS / SMDS_MeshTriangle.cxx
1 using namespace std;
2 // File:        SMDS_MeshTriangle.cxx
3 // Created:     Wed Jan 23 17:02:27 2002
4 // Author:      Jean-Michel BOULCOURT
5 //              <jmb@coulox.paris1.matra-dtv.fr>
6
7
8 #include "SMDS_MeshTriangle.ixx"
9
10
11 //=======================================================================
12 //function : SMDS_MeshTriangle
13 //purpose  : 
14 //=======================================================================
15
16 SMDS_MeshTriangle::SMDS_MeshTriangle(const Standard_Integer ID,
17                                      const Standard_Integer idnode1, 
18                                      const Standard_Integer idnode2, 
19                                      const Standard_Integer idnode3):SMDS_MeshFace(ID,3)
20 {
21   SetConnections(idnode1,idnode2,idnode3);
22   ComputeKey();
23 }
24
25
26 //=======================================================================
27 //function : SetConnections
28 //purpose  : 
29 //=======================================================================
30 void SMDS_MeshTriangle::SetConnections(const Standard_Integer idnode1, 
31                                        const Standard_Integer idnode2,
32                                        const Standard_Integer idnode3)
33 {
34   Standard_Integer idmin = (idnode1 < idnode2 ? idnode1 : idnode2);
35   idmin = (idmin < idnode3 ? idmin : idnode3);
36   
37   myNodes[0] = idmin;
38   if (idmin == idnode1) {
39     myNodes[1] = idnode2;
40     myNodes[2] = idnode3;
41   } else if (idmin == idnode2) {
42     myNodes[1] = idnode3;
43     myNodes[2] = idnode1;
44   } else {
45     myNodes[1] = idnode1;
46     myNodes[2] = idnode2;
47   }
48
49 }
50