1 // Created on: 1991-05-27
2 // Created by: Isabelle GRIGNON
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _IntPatch_WLine_HeaderFile
18 #define _IntPatch_WLine_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Boolean.hxx>
24 #include <Standard_Integer.hxx>
25 #include <IntPatch_SequenceOfPoint.hxx>
26 #include <Bnd_Box2d.hxx>
27 #include <Bnd_Box.hxx>
28 #include <Standard_Real.hxx>
29 #include <IntPatch_PointLine.hxx>
30 #include <IntSurf_TypeTrans.hxx>
31 #include <IntSurf_Situation.hxx>
32 class IntSurf_LineOn2S;
33 class Adaptor2d_HCurve2d;
34 class Standard_OutOfRange;
35 class Standard_DomainError;
37 class IntSurf_PntOn2S;
43 DEFINE_STANDARD_HANDLE(IntPatch_WLine, IntPatch_PointLine)
45 //! Definition of set of points as a result of the intersection
46 //! between 2 parametrised patches.
47 class IntPatch_WLine : public IntPatch_PointLine
53 //! Creates a WLine as an intersection when the
54 //! transitions are In or Out.
55 Standard_EXPORT IntPatch_WLine(const Handle(IntSurf_LineOn2S)& Line, const Standard_Boolean Tang, const IntSurf_TypeTrans Trans1, const IntSurf_TypeTrans Trans2);
57 //! Creates a WLine as an intersection when the
58 //! transitions are Touch.
59 Standard_EXPORT IntPatch_WLine(const Handle(IntSurf_LineOn2S)& Line, const Standard_Boolean Tang, const IntSurf_Situation Situ1, const IntSurf_Situation Situ2);
61 //! Creates a WLine as an intersection when the
62 //! transitions are Undecided.
63 Standard_EXPORT IntPatch_WLine(const Handle(IntSurf_LineOn2S)& Line, const Standard_Boolean Tang);
65 //! Adds a vertex in the list.
66 void AddVertex (const IntPatch_Point& Pnt);
68 //! Set the Point of index <Index> in the LineOn2S
69 Standard_EXPORT void SetPoint (const Standard_Integer Index, const IntPatch_Point& Pnt);
71 //! Replaces the element of range Index in the list
73 //! The exception OutOfRange is raised when
74 //! Index <= 0 or Index > NbVertex.
75 void Replace (const Standard_Integer Index, const IntPatch_Point& Pnt);
77 void SetFirstPoint (const Standard_Integer IndFirst);
79 void SetLastPoint (const Standard_Integer IndLast);
81 //! Returns the number of intersection points.
82 Standard_Integer NbPnts() const Standard_OVERRIDE;
84 //! Returns the intersection point of range Index.
85 const IntSurf_PntOn2S& Point (const Standard_Integer Index) const Standard_OVERRIDE;
87 //! Returns True if the line has a known First point.
88 //! This point is given by the method FirstPoint().
89 Standard_Boolean HasFirstPoint() const;
91 //! Returns True if the line has a known Last point.
92 //! This point is given by the method LastPoint().
93 Standard_Boolean HasLastPoint() const;
95 //! Returns the Point corresponding to the FirstPoint.
96 const IntPatch_Point& FirstPoint() const;
98 //! Returns the Point corresponding to the LastPoint.
99 const IntPatch_Point& LastPoint() const;
101 //! Returns the Point corresponding to the FirstPoint.
102 //! Indfirst is the index of the first in the list
104 const IntPatch_Point& FirstPoint (Standard_Integer& Indfirst) const;
106 //! Returns the Point corresponding to the LastPoint.
107 //! Indlast is the index of the last in the list
109 const IntPatch_Point& LastPoint (Standard_Integer& Indlast) const;
111 Standard_Integer NbVertex() const;
113 //! Returns the vertex of range Index on the line.
114 const IntPatch_Point& Vertex (const Standard_Integer Index) const;
116 //! Set the parameters of all the vertex on the line.
117 //! if a vertex is already in the line,
118 //! its parameter is modified
119 //! else a new point in the line is inserted.
120 Standard_EXPORT void ComputeVertexParameters (const Standard_Real Tol, const Standard_Boolean hasBeenAdded = Standard_False);
122 Standard_EXPORT Handle(IntSurf_LineOn2S) Curve() const;
124 Standard_EXPORT Standard_Boolean IsOutSurf1Box (const gp_Pnt2d& P1);
126 Standard_EXPORT Standard_Boolean IsOutSurf2Box (const gp_Pnt2d& P1);
128 Standard_EXPORT Standard_Boolean IsOutBox (const gp_Pnt& P);
130 Standard_EXPORT void SetPeriod (const Standard_Real pu1, const Standard_Real pv1, const Standard_Real pu2, const Standard_Real pv2);
132 Standard_EXPORT Standard_Real U1Period() const;
134 Standard_EXPORT Standard_Real V1Period() const;
136 Standard_EXPORT Standard_Real U2Period() const;
138 Standard_EXPORT Standard_Real V2Period() const;
140 Standard_EXPORT void SetArcOnS1 (const Handle(Adaptor2d_HCurve2d)& A);
142 Standard_EXPORT Standard_Boolean HasArcOnS1() const;
144 Standard_EXPORT const Handle(Adaptor2d_HCurve2d)& GetArcOnS1() const;
146 Standard_EXPORT void SetArcOnS2 (const Handle(Adaptor2d_HCurve2d)& A);
148 Standard_EXPORT Standard_Boolean HasArcOnS2() const;
150 Standard_EXPORT const Handle(Adaptor2d_HCurve2d)& GetArcOnS2() const;
152 Standard_EXPORT void ClearVertexes();
154 Standard_EXPORT void RemoveVertex (const Standard_Integer theIndex);
156 Standard_EXPORT void InsertVertexBefore (const Standard_Integer theIndex, const IntPatch_Point& thePnt);
158 //! if (theMode == 0) then prints the information about WLine
159 //! if (theMode == 1) then prints the list of 3d-points
160 //! if (theMode == 2) then prints the list of 2d-points on the 1st surface
161 //! Otherwise, prints list of 2d-points on the 2nd surface
162 Standard_EXPORT void Dump(const Standard_Integer theMode) const;
167 DEFINE_STANDARD_RTTIEXT(IntPatch_WLine,IntPatch_PointLine)
177 Handle(IntSurf_LineOn2S) curv;
178 Standard_Boolean fipt;
179 Standard_Boolean lapt;
180 Standard_Integer indf;
181 Standard_Integer indl;
182 IntPatch_SequenceOfPoint svtx;
186 Standard_Real u1period;
187 Standard_Real v1period;
188 Standard_Real u2period;
189 Standard_Real v2period;
190 Standard_Boolean hasArcOnS1;
191 Handle(Adaptor2d_HCurve2d) theArcOnS1;
192 Standard_Boolean hasArcOnS2;
193 Handle(Adaptor2d_HCurve2d) theArcOnS2;
199 #include <IntPatch_WLine.lxx>
205 #endif // _IntPatch_WLine_HeaderFile