b311480e |
1 | // Created on: 1993-09-23 |
2 | // Created by: Didier PIFFAULT |
3 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
b311480e |
16 | |
304c45c8 |
17 | #include <BRepMesh_Triangle.hxx> |
7fd59977 |
18 | |
304c45c8 |
19 | //======================================================================= |
20 | //function : Constructor |
21 | //purpose : |
22 | //======================================================================= |
7fd59977 |
23 | BRepMesh_Triangle::BRepMesh_Triangle() |
304c45c8 |
24 | : myEdge1(0), |
25 | myEdge2(0), |
26 | myEdge3(0), |
c24d4017 |
27 | myOrientation1(Standard_False), |
28 | myOrientation2(Standard_False), |
29 | myOrientation3(Standard_False), |
304c45c8 |
30 | myMovability(BRepMesh_Free) |
31 | { |
32 | } |
7fd59977 |
33 | |
304c45c8 |
34 | //======================================================================= |
35 | //function : Constructor |
36 | //purpose : |
37 | //======================================================================= |
38 | BRepMesh_Triangle::BRepMesh_Triangle (const Standard_Integer theEdge1, |
39 | const Standard_Integer theEdge2, |
40 | const Standard_Integer theEdge3, |
41 | const Standard_Boolean theOrientation1, |
42 | const Standard_Boolean theOrientation2, |
43 | const Standard_Boolean theOrientation3, |
44 | const BRepMesh_DegreeOfFreedom isCanMove) |
45 | : myEdge1(theEdge1), |
46 | myEdge2(theEdge2), |
47 | myEdge3(theEdge3), |
48 | myOrientation1(theOrientation1), |
49 | myOrientation2(theOrientation2), |
50 | myOrientation3(theOrientation3), |
51 | myMovability(isCanMove) |
52 | { |
53 | } |
7fd59977 |
54 | |
304c45c8 |
55 | //======================================================================= |
56 | //function : Initialize |
57 | //purpose : |
58 | //======================================================================= |
59 | void BRepMesh_Triangle::Initialize(const Standard_Integer theEdge1, |
60 | const Standard_Integer theEdge2, |
61 | const Standard_Integer theEdge3, |
62 | const Standard_Boolean theOrientation1, |
63 | const Standard_Boolean theOrientation2, |
64 | const Standard_Boolean theOrientation3, |
65 | const BRepMesh_DegreeOfFreedom isCanMove) |
7fd59977 |
66 | { |
304c45c8 |
67 | myEdge1 = theEdge1; |
68 | myEdge2 = theEdge2; |
69 | myEdge3 = theEdge3; |
70 | myOrientation1 = theOrientation1; |
71 | myOrientation2 = theOrientation2; |
72 | myOrientation3 = theOrientation3; |
73 | myMovability = isCanMove; |
7fd59977 |
74 | } |
75 | |
304c45c8 |
76 | //======================================================================= |
77 | //function : Edges |
78 | //purpose : |
79 | //======================================================================= |
80 | void BRepMesh_Triangle::Edges(Standard_Integer& theEdge1, |
81 | Standard_Integer& theEdge2, |
82 | Standard_Integer& theEdge3, |
83 | Standard_Boolean& theOrientation1, |
84 | Standard_Boolean& theOrientation2, |
85 | Standard_Boolean& theOrientation3) const |
7fd59977 |
86 | { |
304c45c8 |
87 | theEdge1 = myEdge1; |
88 | theEdge2 = myEdge2; |
89 | theEdge3 = myEdge3; |
90 | theOrientation1 = myOrientation1; |
91 | theOrientation2 = myOrientation2; |
92 | theOrientation3 = myOrientation3; |
7fd59977 |
93 | } |
94 | |
304c45c8 |
95 | //======================================================================= |
96 | //function : SetMovability |
97 | //purpose : |
98 | //======================================================================= |
99 | void BRepMesh_Triangle::SetMovability(const BRepMesh_DegreeOfFreedom theMovability) |
7fd59977 |
100 | { |
304c45c8 |
101 | myMovability = theMovability; |
7fd59977 |
102 | } |
103 | |
304c45c8 |
104 | //======================================================================= |
105 | //function : HashCode |
106 | //purpose : |
107 | //======================================================================= |
108 | Standard_Integer BRepMesh_Triangle::HashCode(const Standard_Integer theUpper)const |
7fd59977 |
109 | { |
304c45c8 |
110 | return ::HashCode(myEdge1 + myEdge2 + myEdge3, theUpper); |
7fd59977 |
111 | } |
112 | |
304c45c8 |
113 | //======================================================================= |
114 | //function : IsEqual |
115 | //purpose : |
116 | //======================================================================= |
117 | Standard_Boolean BRepMesh_Triangle::IsEqual(const BRepMesh_Triangle& theOther) const |
7fd59977 |
118 | { |
304c45c8 |
119 | if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted) |
7fd59977 |
120 | return Standard_False; |
304c45c8 |
121 | |
122 | if (myEdge1 == theOther.myEdge1 && |
123 | myEdge2 == theOther.myEdge2 && |
124 | myEdge3 == theOther.myEdge3) |
125 | { |
7fd59977 |
126 | return Standard_True; |
304c45c8 |
127 | } |
128 | |
129 | if (myEdge1 == theOther.myEdge2 && |
130 | myEdge2 == theOther.myEdge3 && |
131 | myEdge3 == theOther.myEdge1) |
132 | { |
7fd59977 |
133 | return Standard_True; |
304c45c8 |
134 | } |
135 | |
136 | if (myEdge1 == theOther.myEdge3 && |
137 | myEdge2 == theOther.myEdge1 && |
138 | myEdge3 == theOther.myEdge2) |
139 | { |
7fd59977 |
140 | return Standard_True; |
304c45c8 |
141 | } |
142 | |
7fd59977 |
143 | return Standard_False; |
144 | } |