summaryrefslogtreecommitdiff
path: root/inc/IntPatch_PrmPrmIntersection.lxx
blob: 1984f47b924a6f99d7e8225c00d42a9422dc94f7 (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
#include <StdFail_NotDone.hxx>
#include <IntPatch_Line.hxx>



#define _DECAL    7
#define _DECAL2   14
#define _BASE     128
#define _BASEM1   127


//======================================================================
inline Standard_Integer IntPatch_PrmPrmIntersection::NbLines() const { 
  if(!done) 
    StdFail_NotDone::Raise(" IntPatch_PrmPrmIntersection ");
  return(SLin.Length());
}

//======================================================================
inline const Handle(IntPatch_Line)& IntPatch_PrmPrmIntersection::Line
  (const Standard_Integer n) const {
  if(!done) 
    StdFail_NotDone::Raise(" IntPatch_PrmPrmIntersection ");
  return(SLin.Value(n));
}

//======================================================================
inline Standard_Boolean IntPatch_PrmPrmIntersection::IsEmpty() const { 
  if(!done) 
    StdFail_NotDone::Raise(" IntPatch_PrmPrmIntersection ");
  return(empt);
}

//======================================================================
inline Standard_Boolean IntPatch_PrmPrmIntersection::IsDone() const { 
  return(done);
}

inline Standard_Integer IntPatch_PrmPrmIntersection::GrilleInteger(const Standard_Integer ix,
								   const Standard_Integer iy,
								   const Standard_Integer iz) const 
{ 
  Standard_Integer tz = iz<<_DECAL2;
  Standard_Integer ty = iy<<_DECAL;
  Standard_Integer t  = ix;
  t|=ty;
  t|=tz;
  return(t);
}

inline void IntPatch_PrmPrmIntersection::IntegerGrille(const Standard_Integer tt,
						       Standard_Integer &ix,
						       Standard_Integer &iy,
						       Standard_Integer &iz) const 
{ 
  Standard_Integer t = tt;
  ix = t & _BASEM1;
  t>>=_DECAL;
  iy = t & _BASEM1;
  t>>=_DECAL;
  iz = t;
}

inline Standard_Integer IntPatch_PrmPrmIntersection::DansGrille(const Standard_Integer t) const 
{
  if(t>=0) {
    if(t<_BASE){ 
      return(1);
    }
  }
  return(0);
}

inline Standard_Integer IntPatch_PrmPrmIntersection::NbPointsGrille() const
{ return(_BASE); } 


inline Standard_Integer IntPatch_PrmPrmIntersection::CodeReject(const Standard_Real x0,
								const Standard_Real y0,
								const Standard_Real z0,
								const Standard_Real x1,
								const Standard_Real y1,
								const Standard_Real z1,
								const Standard_Real x,
								const Standard_Real y,
								const Standard_Real z) const 
{      
  int code = 0;
  if(x<x0) code =1; 
  if(y<y0) code|=2;
  if(z<z0) code|=4;
  if(x>x1) code|=8;
  if(y>y1) code|=16;
  if(z>z1) code|=32;
  return(code);
}