0023105: Exception during Meshing / Missing triangles
[occt.git] / src / BRepMesh / BRepMesh_Triangle.cxx
CommitLineData
b311480e 1// Created on: 1993-09-23
2// Created by: Didier PIFFAULT
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
304c45c8 21#include <BRepMesh_Triangle.hxx>
7fd59977 22
304c45c8 23//=======================================================================
24//function : Constructor
25//purpose :
26//=======================================================================
7fd59977 27BRepMesh_Triangle::BRepMesh_Triangle()
304c45c8 28: myEdge1(0),
29 myEdge2(0),
30 myEdge3(0),
31 myMovability(BRepMesh_Free)
32{
33}
7fd59977 34
304c45c8 35//=======================================================================
36//function : Constructor
37//purpose :
38//=======================================================================
39BRepMesh_Triangle::BRepMesh_Triangle (const Standard_Integer theEdge1,
40 const Standard_Integer theEdge2,
41 const Standard_Integer theEdge3,
42 const Standard_Boolean theOrientation1,
43 const Standard_Boolean theOrientation2,
44 const Standard_Boolean theOrientation3,
45 const BRepMesh_DegreeOfFreedom isCanMove)
46: myEdge1(theEdge1),
47 myEdge2(theEdge2),
48 myEdge3(theEdge3),
49 myOrientation1(theOrientation1),
50 myOrientation2(theOrientation2),
51 myOrientation3(theOrientation3),
52 myMovability(isCanMove)
53{
54}
7fd59977 55
304c45c8 56//=======================================================================
57//function : Initialize
58//purpose :
59//=======================================================================
60void BRepMesh_Triangle::Initialize(const Standard_Integer theEdge1,
61 const Standard_Integer theEdge2,
62 const Standard_Integer theEdge3,
63 const Standard_Boolean theOrientation1,
64 const Standard_Boolean theOrientation2,
65 const Standard_Boolean theOrientation3,
66 const BRepMesh_DegreeOfFreedom isCanMove)
7fd59977 67{
304c45c8 68 myEdge1 = theEdge1;
69 myEdge2 = theEdge2;
70 myEdge3 = theEdge3;
71 myOrientation1 = theOrientation1;
72 myOrientation2 = theOrientation2;
73 myOrientation3 = theOrientation3;
74 myMovability = isCanMove;
7fd59977 75}
76
304c45c8 77//=======================================================================
78//function : Edges
79//purpose :
80//=======================================================================
81void BRepMesh_Triangle::Edges(Standard_Integer& theEdge1,
82 Standard_Integer& theEdge2,
83 Standard_Integer& theEdge3,
84 Standard_Boolean& theOrientation1,
85 Standard_Boolean& theOrientation2,
86 Standard_Boolean& theOrientation3) const
7fd59977 87{
304c45c8 88 theEdge1 = myEdge1;
89 theEdge2 = myEdge2;
90 theEdge3 = myEdge3;
91 theOrientation1 = myOrientation1;
92 theOrientation2 = myOrientation2;
93 theOrientation3 = myOrientation3;
7fd59977 94}
95
304c45c8 96//=======================================================================
97//function : SetMovability
98//purpose :
99//=======================================================================
100void BRepMesh_Triangle::SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
7fd59977 101{
304c45c8 102 myMovability = theMovability;
7fd59977 103}
104
304c45c8 105//=======================================================================
106//function : HashCode
107//purpose :
108//=======================================================================
109Standard_Integer BRepMesh_Triangle::HashCode(const Standard_Integer theUpper)const
7fd59977 110{
304c45c8 111 return ::HashCode(myEdge1 + myEdge2 + myEdge3, theUpper);
7fd59977 112}
113
304c45c8 114//=======================================================================
115//function : IsEqual
116//purpose :
117//=======================================================================
118Standard_Boolean BRepMesh_Triangle::IsEqual(const BRepMesh_Triangle& theOther) const
7fd59977 119{
304c45c8 120 if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
7fd59977 121 return Standard_False;
304c45c8 122
123 if (myEdge1 == theOther.myEdge1 &&
124 myEdge2 == theOther.myEdge2 &&
125 myEdge3 == theOther.myEdge3)
126 {
7fd59977 127 return Standard_True;
304c45c8 128 }
129
130 if (myEdge1 == theOther.myEdge2 &&
131 myEdge2 == theOther.myEdge3 &&
132 myEdge3 == theOther.myEdge1)
133 {
7fd59977 134 return Standard_True;
304c45c8 135 }
136
137 if (myEdge1 == theOther.myEdge3 &&
138 myEdge2 == theOther.myEdge1 &&
139 myEdge3 == theOther.myEdge2)
140 {
7fd59977 141 return Standard_True;
304c45c8 142 }
143
7fd59977 144 return Standard_False;
145}