0027780: Face-face intersection produces 2D curve that has reversed derivative at...
[occt.git] / src / IntPatch / IntPatch_RLine.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-04-06
2// Created by: Jacques GOUSSARD
3// Copyright (c) 1992-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_RLine_HeaderFile
18#define _IntPatch_RLine_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_Type.hxx>
22
23#include <Standard_Boolean.hxx>
24#include <Standard_Real.hxx>
25#include <Standard_Integer.hxx>
26#include <IntPatch_SequenceOfPoint.hxx>
27#include <IntPatch_PointLine.hxx>
28#include <IntSurf_TypeTrans.hxx>
29#include <IntSurf_Situation.hxx>
30class Adaptor2d_HCurve2d;
31class IntSurf_LineOn2S;
32class Standard_DomainError;
33class Standard_OutOfRange;
34class IntPatch_Point;
35class IntSurf_PntOn2S;
36
37
38class IntPatch_RLine;
39DEFINE_STANDARD_HANDLE(IntPatch_RLine, IntPatch_PointLine)
40
41//! Implementation of an intersection line described by a
42//! restriction line on one of the surfaces.
43class IntPatch_RLine : public IntPatch_PointLine
44{
45
46public:
47
48
49 //! Creates a restriction as an intersection line
50 //! when the transitions are In or Out.
51 Standard_EXPORT IntPatch_RLine(const Standard_Boolean Tang, const IntSurf_TypeTrans Trans1, const IntSurf_TypeTrans Trans2);
52
53 //! Creates a restriction as an intersection line
54 //! when the transitions are Touch.
55 Standard_EXPORT IntPatch_RLine(const Standard_Boolean Tang, const IntSurf_Situation Situ1, const IntSurf_Situation Situ2);
56
57 //! Creates a restriction as an intersection line
58 //! when the transitions are Undecided.
59 Standard_EXPORT IntPatch_RLine(const Standard_Boolean Tang);
60
b8f67cc2 61 //! Adds a vertex in the list. If theIsPrepend == TRUE the new
62 //! vertex will be added before the first element of vertices sequence.
63 //! Otherwise, to the end of the sequence
64 virtual void AddVertex (const IntPatch_Point& Pnt,
65 const Standard_Boolean theIsPrepend = Standard_False) Standard_OVERRIDE;
42cf5bc1 66
67 //! Replaces the element of range Index in the list
68 //! of points.
69 void Replace (const Standard_Integer Index, const IntPatch_Point& Pnt);
70
71 void SetFirstPoint (const Standard_Integer IndFirst);
72
73 void SetLastPoint (const Standard_Integer IndLast);
74
75 void Add (const Handle(IntSurf_LineOn2S)& L);
76
77 //! Returns True if the intersection is on the domain of the
78 //! first patch.
79 //! Returns False if the intersection is on the domain of
80 //! the second patch.
81 Standard_Boolean IsArcOnS1() const;
82
83 //! Returns True if the intersection is on the domain of the
84 //! first patch.
85 //! Returns False if the intersection is on the domain of
86 //! the second patch.
87 Standard_Boolean IsArcOnS2() const;
88
89 Standard_EXPORT void SetArcOnS1 (const Handle(Adaptor2d_HCurve2d)& A);
90
91 Standard_EXPORT void SetArcOnS2 (const Handle(Adaptor2d_HCurve2d)& A);
92
93 Standard_EXPORT void SetParamOnS1 (const Standard_Real p1, const Standard_Real p2);
94
95 Standard_EXPORT void SetParamOnS2 (Standard_Real& p1, Standard_Real& p2);
96
97 //! Returns the concerned arc.
98 const Handle(Adaptor2d_HCurve2d)& ArcOnS1() const;
99
100 //! Returns the concerned arc.
101 const Handle(Adaptor2d_HCurve2d)& ArcOnS2() const;
102
103 Standard_EXPORT void ParamOnS1 (Standard_Real& p1, Standard_Real& p2) const;
104
105 Standard_EXPORT void ParamOnS2 (Standard_Real& p1, Standard_Real& p2) const;
106
107 //! Returns True if the line has a known First point.
108 //! This point is given by the method FirstPoint().
109 Standard_Boolean HasFirstPoint() const;
110
111 //! Returns True if the line has a known Last point.
112 //! This point is given by the method LastPoint().
113 Standard_Boolean HasLastPoint() const;
114
115 //! Returns the IntPoint corresponding to the FirstPoint.
116 //! An exception is raised when HasFirstPoint returns False.
117 const IntPatch_Point& FirstPoint() const;
118
119 //! Returns the IntPoint corresponding to the LastPoint.
120 //! An exception is raised when HasLastPoint returns False.
121 const IntPatch_Point& LastPoint() const;
122
77dbd1f1 123 //! Returns number of vertices (IntPatch_Point) of the line
d677b214 124 virtual Standard_Integer NbVertex() const Standard_OVERRIDE;
42cf5bc1 125
126 //! Returns the vertex of range Index on the line.
d677b214 127 virtual const IntPatch_Point& Vertex (const Standard_Integer Index) const Standard_OVERRIDE;
eee615ad 128
129 //! Returns the vertex of range Index on the line.
130 virtual IntPatch_Point& ChangeVertex (const Standard_Integer Index) Standard_OVERRIDE;
42cf5bc1 131
eee615ad 132 //! Removes single vertex from the line
133 virtual void RemoveVertex (const Standard_Integer theIndex) Standard_OVERRIDE;
134
42cf5bc1 135 Standard_Boolean HasPolygon() const;
136
137 //! Returns the number of intersection points.
77dbd1f1 138 virtual Standard_Integer NbPnts() const Standard_OVERRIDE;
42cf5bc1 139
140 //! Returns the intersection point of range Index.
77dbd1f1 141 virtual const IntSurf_PntOn2S& Point (const Standard_Integer Index) const Standard_OVERRIDE;
42cf5bc1 142
143 //! Set the Point of index <Index> in the LineOn2S
144 Standard_EXPORT void SetPoint (const Standard_Integer Index, const IntPatch_Point& Pnt);
145
146 //! Set the parameters of all the vertex on the line.
147 //! if a vertex is already in the line,
148 //! its parameter is modified
149 //! else a new point in the line is inserted.
150 Standard_EXPORT void ComputeVertexParameters (const Standard_Real Tol);
151
77dbd1f1 152 //! Returns set of intersection points
d677b214 153 Standard_EXPORT virtual Handle(IntSurf_LineOn2S) Curve() const Standard_OVERRIDE;
77dbd1f1 154
155 //! Removes vertices from the line (i.e. cleans svtx member)
d677b214 156 virtual void ClearVertexes() Standard_OVERRIDE
77dbd1f1 157 {
158 svtx.Clear();
159 }
160
161 void SetCurve(const Handle(IntSurf_LineOn2S)& theNewCurve)
162 {
163 curv = theNewCurve;
164 }
165
166 //! if (theMode == 0) then prints the information about WLine
167 //! if (theMode == 1) then prints the list of 3d-points
168 //! if (theMode == 2) then prints the list of 2d-points on the 1st surface
169 //! Otherwise, prints list of 2d-points on the 2nd surface
170 Standard_EXPORT void Dump(const Standard_Integer theMode) const;
42cf5bc1 171
92efcf78 172 DEFINE_STANDARD_RTTIEXT(IntPatch_RLine,IntPatch_PointLine)
42cf5bc1 173
174protected:
175
176
177
178
179private:
180
181
182 Handle(Adaptor2d_HCurve2d) theArcOnS1;
183 Handle(Adaptor2d_HCurve2d) theArcOnS2;
184 Standard_Boolean onS1;
185 Standard_Boolean onS2;
186 Standard_Real ParamInf1;
187 Standard_Real ParamSup1;
188 Standard_Real ParamInf2;
189 Standard_Real ParamSup2;
190 Handle(IntSurf_LineOn2S) curv;
191 Standard_Boolean fipt;
192 Standard_Boolean lapt;
193 Standard_Integer indf;
194 Standard_Integer indl;
195 IntPatch_SequenceOfPoint svtx;
196
197
198};
199
200
201#include <IntPatch_RLine.lxx>
202
203
204
205
206
207#endif // _IntPatch_RLine_HeaderFile