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
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.
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.
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.
21 #include <BRepMesh_Triangle.hxx>
23 //=======================================================================
24 //function : Constructor
26 //=======================================================================
27 BRepMesh_Triangle::BRepMesh_Triangle()
31 myMovability(BRepMesh_Free)
35 //=======================================================================
36 //function : Constructor
38 //=======================================================================
39 BRepMesh_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)
49 myOrientation1(theOrientation1),
50 myOrientation2(theOrientation2),
51 myOrientation3(theOrientation3),
52 myMovability(isCanMove)
56 //=======================================================================
57 //function : Initialize
59 //=======================================================================
60 void 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)
71 myOrientation1 = theOrientation1;
72 myOrientation2 = theOrientation2;
73 myOrientation3 = theOrientation3;
74 myMovability = isCanMove;
77 //=======================================================================
80 //=======================================================================
81 void 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
91 theOrientation1 = myOrientation1;
92 theOrientation2 = myOrientation2;
93 theOrientation3 = myOrientation3;
96 //=======================================================================
97 //function : SetMovability
99 //=======================================================================
100 void BRepMesh_Triangle::SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
102 myMovability = theMovability;
105 //=======================================================================
106 //function : HashCode
108 //=======================================================================
109 Standard_Integer BRepMesh_Triangle::HashCode(const Standard_Integer theUpper)const
111 return ::HashCode(myEdge1 + myEdge2 + myEdge3, theUpper);
114 //=======================================================================
117 //=======================================================================
118 Standard_Boolean BRepMesh_Triangle::IsEqual(const BRepMesh_Triangle& theOther) const
120 if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
121 return Standard_False;
123 if (myEdge1 == theOther.myEdge1 &&
124 myEdge2 == theOther.myEdge2 &&
125 myEdge3 == theOther.myEdge3)
127 return Standard_True;
130 if (myEdge1 == theOther.myEdge2 &&
131 myEdge2 == theOther.myEdge3 &&
132 myEdge3 == theOther.myEdge1)
134 return Standard_True;
137 if (myEdge1 == theOther.myEdge3 &&
138 myEdge2 == theOther.myEdge1 &&
139 myEdge3 == theOther.myEdge2)
141 return Standard_True;
144 return Standard_False;