summaryrefslogtreecommitdiff
path: root/src/BRepMesh/BRepMesh_Triangle.cxx
blob: ceed8e9ba3d1f6e3b3ba593cda5109e8a5c1c06f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// File:        BRepMesh_Triangle.cxx
// Created:     Thu Sep 23 13:10:58 1993
// Author:      Didier PIFFAULT
//              <dpf@zerox>

#include <BRepMesh_Triangle.ixx>

BRepMesh_Triangle::BRepMesh_Triangle()
: Edge1(0), Edge2(0), Edge3(0), myMovability(BRepMesh_Free)
{}

BRepMesh_Triangle::BRepMesh_Triangle (const Standard_Integer e1, 
                                      const Standard_Integer e2,
                                      const Standard_Integer e3,
                                      const Standard_Boolean o1, 
                                      const Standard_Boolean o2,
                                      const Standard_Boolean o3,
                                      const BRepMesh_DegreeOfFreedom  canMove)
                                      : Edge1(e1),  Orientation1(o1),Edge2(e2), Orientation2(o2), 
                                      Edge3(e3), Orientation3(o3), 
                                      myMovability(canMove)
{}

void  BRepMesh_Triangle::Initialize(const Standard_Integer e1,
                                    const Standard_Integer e2,
                                    const Standard_Integer e3,
                                    const Standard_Boolean o1, 
                                    const Standard_Boolean o2,
                                    const Standard_Boolean o3,
                                    const BRepMesh_DegreeOfFreedom  canMove)
{
  Edge1        =e1;
  Edge2        =e2;
  Edge3        =e3;
  Orientation1 =o1;
  Orientation2 =o2;
  Orientation3 =o3;
  myMovability =canMove;
}

void  BRepMesh_Triangle::Edges(Standard_Integer& e1,
                               Standard_Integer& e2,
                               Standard_Integer& e3,
                               Standard_Boolean& o1, 
                               Standard_Boolean& o2,
                               Standard_Boolean& o3)const 
{
  e1=Edge1;
  e2=Edge2;
  e3=Edge3;
  o1=Orientation1;
  o2=Orientation2;
  o3=Orientation3;
}

void  BRepMesh_Triangle::SetMovability(const BRepMesh_DegreeOfFreedom  Move)
{
  myMovability =Move;
}

Standard_Integer BRepMesh_Triangle::HashCode
(const Standard_Integer Upper)const 
{
  return ::HashCode(Edge1+Edge2+Edge3, Upper);
}

Standard_Boolean BRepMesh_Triangle::IsEqual
(const BRepMesh_Triangle& Other)const 
{
  if (myMovability==BRepMesh_Deleted || Other.myMovability==BRepMesh_Deleted)
    return Standard_False;
  if (Edge1==Other.Edge1 && Edge2==Other.Edge2 && Edge3==Other.Edge3)
    return Standard_True;
  if (Edge1==Other.Edge2 && Edge2==Other.Edge3 && Edge3==Other.Edge1)
    return Standard_True;
  if (Edge1==Other.Edge3 && Edge2==Other.Edge1 && Edge3==Other.Edge2)
    return Standard_True;
  return Standard_False;
}