b311480e |
1 | // Copyright (c) 1995-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
7fd59977 |
15 | #include <StdFail_NotDone.hxx> |
16 | #include <IntPatch_Line.hxx> |
17 | |
18 | |
19 | |
20 | #define _DECAL 7 |
21 | #define _DECAL2 14 |
22 | #define _BASE 128 |
23 | #define _BASEM1 127 |
24 | |
25 | |
26 | //====================================================================== |
27 | inline Standard_Integer IntPatch_PrmPrmIntersection::NbLines() const { |
28 | if(!done) |
29 | StdFail_NotDone::Raise(" IntPatch_PrmPrmIntersection "); |
30 | return(SLin.Length()); |
31 | } |
32 | |
33 | //====================================================================== |
34 | inline const Handle(IntPatch_Line)& IntPatch_PrmPrmIntersection::Line |
35 | (const Standard_Integer n) const { |
36 | if(!done) |
37 | StdFail_NotDone::Raise(" IntPatch_PrmPrmIntersection "); |
38 | return(SLin.Value(n)); |
39 | } |
40 | |
41 | //====================================================================== |
42 | inline Standard_Boolean IntPatch_PrmPrmIntersection::IsEmpty() const { |
43 | if(!done) |
44 | StdFail_NotDone::Raise(" IntPatch_PrmPrmIntersection "); |
45 | return(empt); |
46 | } |
47 | |
48 | //====================================================================== |
49 | inline Standard_Boolean IntPatch_PrmPrmIntersection::IsDone() const { |
50 | return(done); |
51 | } |
52 | |
53 | inline Standard_Integer IntPatch_PrmPrmIntersection::GrilleInteger(const Standard_Integer ix, |
54 | const Standard_Integer iy, |
55 | const Standard_Integer iz) const |
56 | { |
57 | Standard_Integer tz = iz<<_DECAL2; |
58 | Standard_Integer ty = iy<<_DECAL; |
59 | Standard_Integer t = ix; |
60 | t|=ty; |
61 | t|=tz; |
62 | return(t); |
63 | } |
64 | |
65 | inline void IntPatch_PrmPrmIntersection::IntegerGrille(const Standard_Integer tt, |
66 | Standard_Integer &ix, |
67 | Standard_Integer &iy, |
68 | Standard_Integer &iz) const |
69 | { |
70 | Standard_Integer t = tt; |
71 | ix = t & _BASEM1; |
72 | t>>=_DECAL; |
73 | iy = t & _BASEM1; |
74 | t>>=_DECAL; |
75 | iz = t; |
76 | } |
77 | |
78 | inline Standard_Integer IntPatch_PrmPrmIntersection::DansGrille(const Standard_Integer t) const |
79 | { |
80 | if(t>=0) { |
81 | if(t<_BASE){ |
82 | return(1); |
83 | } |
84 | } |
85 | return(0); |
86 | } |
87 | |
88 | inline Standard_Integer IntPatch_PrmPrmIntersection::NbPointsGrille() const |
89 | { return(_BASE); } |
90 | |
91 | |
92 | inline Standard_Integer IntPatch_PrmPrmIntersection::CodeReject(const Standard_Real x0, |
93 | const Standard_Real y0, |
94 | const Standard_Real z0, |
95 | const Standard_Real x1, |
96 | const Standard_Real y1, |
97 | const Standard_Real z1, |
98 | const Standard_Real x, |
99 | const Standard_Real y, |
100 | const Standard_Real z) const |
101 | { |
102 | int code = 0; |
103 | if(x<x0) code =1; |
104 | if(y<y0) code|=2; |
105 | if(z<z0) code|=4; |
106 | if(x>x1) code|=8; |
107 | if(y>y1) code|=16; |
108 | if(z>z1) code|=32; |
109 | return(code); |
110 | } |