0027664: Incomplete intersection curve from the attached shapes
[occt.git] / src / IntPatch / IntPatch_PrmPrmIntersection.hxx
1 // Created on: 1993-01-28
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _IntPatch_PrmPrmIntersection_HeaderFile
18 #define _IntPatch_PrmPrmIntersection_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Boolean.hxx>
25 #include <IntPatch_SequenceOfLine.hxx>
26 #include <Standard_Real.hxx>
27 #include <IntSurf_ListOfPntOn2S.hxx>
28 #include <Standard_Integer.hxx>
29 class Standard_OutOfRange;
30 class StdFail_NotDone;
31 class Adaptor3d_HSurface;
32 class IntPatch_Polyhedron;
33 class Adaptor3d_TopolTool;
34 class IntPatch_Line;
35 class IntPatch_PrmPrmIntersection_T3Bits;
36 class IntSurf_LineOn2S;
37
38
39 //! Implementation  of   the Intersection      between two
40 //! bi-parametrised surfaces.
41 //!
42 //! To  avoid  multiple constructions of  the approximated
43 //! polyhedron  of the    surfaces, the algorithm  can  be
44 //! called whith the  two  surfaces  and their  associated
45 //! polyhedron.
46 class IntPatch_PrmPrmIntersection 
47 {
48 public:
49
50   DEFINE_STANDARD_ALLOC
51
52   
53   //! Empty Constructor
54   Standard_EXPORT IntPatch_PrmPrmIntersection();
55   
56   //! Performs the intersection between <Caro1>  and
57   //! <Caro2>.  Associated Polyhedrons <Polyhedron1>
58   //! and <Polyhedron2> are given.
59   Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const IntPatch_Polyhedron& Polyhedron1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const IntPatch_Polyhedron& Polyhedron2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
60   
61   Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const IntPatch_Polyhedron& Polyhedron1, const Handle(Adaptor3d_TopolTool)& Domain1, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
62   
63   //! Performs the intersection between <Caro1>  and
64   //! <Caro2>. The method computes the polyhedron on
65   //! each surface.
66   Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment, const Standard_Boolean ClearFlag = Standard_True);
67   
68   //! Performs the intersection between <Caro1>  and
69   //! <Caro2>. The method computes the polyhedron on
70   //! each surface.
71   Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment, IntSurf_ListOfPntOn2S& ListOfPnts, const Standard_Boolean RestrictLine);
72   
73   //! Performs the intersection between <Caro1>  and
74   //! <Caro2>. The method computes the polyhedron on
75   //! each surface.
76   Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real U1, const Standard_Real V1, const Standard_Real U2, const Standard_Real V2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
77   
78   //! Performs the intersection between <Caro1>  and
79   //! <Caro2>. The method computes the polyhedron on
80   //! each surface.
81   Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
82   
83   //! Performs  the intersection between <Caro1> and
84   //! <Caro2>.
85   //!
86   //! The polyhedron which approximates     <Caro2>,
87   //! <Polyhedron2> is given. The other one is
88   //! computed.
89   Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const IntPatch_Polyhedron& Polyhedron2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
90   
91   //! Performs  the intersection between <Caro1> and
92   //! <Caro2>.
93   //!
94   //! The polyhedron which approximates     <Caro1>,
95   //! <Polyhedron1> is given. The other one is
96   //! computed.
97   Standard_EXPORT void Perform (const Handle(Adaptor3d_HSurface)& Caro1, const IntPatch_Polyhedron& Polyhedron1, const Handle(Adaptor3d_TopolTool)& Domain1, const Handle(Adaptor3d_HSurface)& Caro2, const Handle(Adaptor3d_TopolTool)& Domain2, const Standard_Real TolTangency, const Standard_Real Epsilon, const Standard_Real Deflection, const Standard_Real Increment);
98   
99   //! Returns true if the calculus was succesfull.
100     Standard_Boolean IsDone() const;
101   
102   //! Returns true if the is no intersection.
103     Standard_Boolean IsEmpty() const;
104   
105   //! Returns the number of intersection lines.
106     Standard_Integer NbLines() const;
107   
108   //! Returns the line of range Index.
109   //! An exception is raised if Index<=0 or Index>NbLine.
110     const Handle(IntPatch_Line)& Line (const Standard_Integer Index) const;
111   
112   //! Computes about <NbPoints>  Intersection Points  on
113   //! the Line <IndexLine> between  the Points of  Index
114   //! <LowPoint> and <HighPoint>.
115   //!
116   //! All  the points  of the line  of index <IndexLine>
117   //! with an index  between <LowPoint>  and <HighPoint>
118   //! are in the returned  line. New Points are inserted
119   //! between existing points  if  those  points are not
120   //! too closed.
121   //!
122   //! An exception is raised if Index<=0 or Index>NbLine.
123   //! or if IsDone returns False
124   Standard_EXPORT Handle(IntPatch_Line) NewLine (const Handle(Adaptor3d_HSurface)& Caro1, const Handle(Adaptor3d_HSurface)& Caro2, const Standard_Integer IndexLine, const Standard_Integer LowPoint, const Standard_Integer HighPoint, const Standard_Integer NbPoints) const;
125   
126     Standard_Integer GrilleInteger (const Standard_Integer ix, const Standard_Integer iy, const Standard_Integer iz) const;
127   
128     void IntegerGrille (const Standard_Integer t, Standard_Integer& ix, Standard_Integer& iy, Standard_Integer& iz) const;
129   
130     Standard_Integer DansGrille (const Standard_Integer t) const;
131   
132     Standard_Integer NbPointsGrille() const;
133   
134   Standard_EXPORT void RemplitLin (const Standard_Integer x1, const Standard_Integer y1, const Standard_Integer z1, const Standard_Integer x2, const Standard_Integer y2, const Standard_Integer z2, IntPatch_PrmPrmIntersection_T3Bits& Map) const;
135   
136   Standard_EXPORT void RemplitTri (const Standard_Integer x1, const Standard_Integer y1, const Standard_Integer z1, const Standard_Integer x2, const Standard_Integer y2, const Standard_Integer z2, const Standard_Integer x3, const Standard_Integer y3, const Standard_Integer z3, IntPatch_PrmPrmIntersection_T3Bits& Map) const;
137   
138   Standard_EXPORT void Remplit (const Standard_Integer a, const Standard_Integer b, const Standard_Integer c, IntPatch_PrmPrmIntersection_T3Bits& Map) const;
139   
140   Standard_EXPORT Standard_Integer CodeReject (const Standard_Real x1, const Standard_Real y1, const Standard_Real z1, const Standard_Real x2, const Standard_Real y2, const Standard_Real z2, const Standard_Real x3, const Standard_Real y3, const Standard_Real z3) const;
141   
142   Standard_EXPORT void PointDepart (Handle(IntSurf_LineOn2S)& LineOn2S, const Handle(Adaptor3d_HSurface)& S1, const Standard_Integer SU1, const Standard_Integer SV1, const Handle(Adaptor3d_HSurface)& S2, const Standard_Integer SU2, const Standard_Integer SV2) const;
143
144
145
146
147 protected:
148
149
150
151
152
153 private:
154
155
156
157   Standard_Boolean done;
158   Standard_Boolean empt;
159   IntPatch_SequenceOfLine SLin;
160
161
162 };
163
164
165 #include <IntPatch_PrmPrmIntersection.lxx>
166
167
168
169
170
171 #endif // _IntPatch_PrmPrmIntersection_HeaderFile