summaryrefslogtreecommitdiff
path: root/src/HLRBRep/HLRBRep_EdgeInterferenceTool.cxx
blob: 1f3369413ee67c105c8a07bc149ae094be95730d (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// File:	HLRBRep_EdgeInterferenceTool.cxx
// Created:	Thu Apr 17 21:22:03 1997
// Author:	Christophe MARION
//		<cma@partox.paris1.matra-dtv.fr>
#ifndef No_Exception
#define No_Exception
#endif
#include <HLRBRep_EdgeInterferenceTool.ixx>

//=======================================================================
//function : HLRBRep_EdgeInterferenceTool
//purpose  : 
//=======================================================================

HLRBRep_EdgeInterferenceTool::HLRBRep_EdgeInterferenceTool
  (const Handle(HLRBRep_Data)& DS) : myDS(DS)
{
}

//=======================================================================
//function : LoadEdge
//purpose  : 
//=======================================================================

void HLRBRep_EdgeInterferenceTool::LoadEdge()
{
  Standard_Real p1,p2;
  Standard_ShortReal t1,t2;
  HLRBRep_Array1OfEData& EData = myDS->EDataArray();
  HLRBRep_EdgeData& ed = EData(myDS->Edge());
  ed.Status().Bounds(p1,t1,p2,t2);
  inter[0].Parameter(p1);
  inter[0].Tolerance(t1);
  inter[0].Index(ed.VSta());
  inter[1].Parameter(p2);
  inter[1].Tolerance(t2);
  inter[1].Index(ed.VEnd());
}

//=======================================================================
//function : EdgeGeometry
//purpose  : 
//=======================================================================

void HLRBRep_EdgeInterferenceTool::EdgeGeometry
  (const Standard_Real Param,
   gp_Dir& Tgt,
   gp_Dir& Nrm,
   Standard_Real& CrLE) const
{
  gp_Dir2d TgLE,NmLE;
  myDS->LocalLEGeometry2D(Param,TgLE,NmLE,CrLE);
  Tgt.SetCoord(TgLE.X(),TgLE.Y(),0);
  Nrm.SetCoord(NmLE.X(),NmLE.Y(),0);
}

//=======================================================================
//function : SameInterferences
//purpose  : 
//=======================================================================

Standard_Boolean HLRBRep_EdgeInterferenceTool::SameInterferences
  (const HLRAlgo_Interference& I1,
   const HLRAlgo_Interference& I2) const
{
  Standard_Integer ind1 = I1.Intersection().Index();
  Standard_Integer ind2 = I2.Intersection().Index();
  if ( ind1 != 0 && ind2 != 0 ) return ind1 == ind2;
  return Standard_False;
}

//=======================================================================
//function : SameVertexAndInterference
//purpose  : 
//=======================================================================

Standard_Boolean HLRBRep_EdgeInterferenceTool::SameVertexAndInterference
  (const HLRAlgo_Interference& I) const
{
  if (I.Intersection().Index() == inter[cur].Index())
    return Standard_True;
  return I.Intersection().Orientation() == 
    ((cur == 0) ? TopAbs_FORWARD : TopAbs_REVERSED);
}

//=======================================================================
//function : InterferenceBoundaryGeometry
//purpose  : 
//=======================================================================

void HLRBRep_EdgeInterferenceTool::InterferenceBoundaryGeometry
  (const HLRAlgo_Interference& I,
   gp_Dir& Tang,
   gp_Dir& Norm,
   Standard_Real& CrFE) const
{
  Standard_Integer FE;
  Standard_Real Param;
  gp_Dir2d TgFE,NmFE;
  I.Boundary().Value2D(FE,Param);
  myDS->LocalFEGeometry2D(FE,Param,TgFE,NmFE,CrFE);
  Tang.SetCoord(TgFE.X(),TgFE.Y(),0);
  Norm.SetCoord(NmFE.X(),NmFE.Y(),0);
}