0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / GccAna / GccAna_Lin2dTanPer.hxx
1 // Created on: 1991-04-03
2 // Created by: Remi GILET
3 // Copyright (c) 1991-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 _GccAna_Lin2dTanPer_HeaderFile
18 #define _GccAna_Lin2dTanPer_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 #include <TColgp_Array1OfLin2d.hxx>
27 #include <GccEnt_Array1OfPosition.hxx>
28 #include <TColgp_Array1OfPnt2d.hxx>
29 #include <TColStd_Array1OfReal.hxx>
30 #include <GccEnt_Position.hxx>
31 #include <Standard_Real.hxx>
32 class GccEnt_BadQualifier;
33 class Standard_OutOfRange;
34 class Standard_ConstructionError;
35 class StdFail_NotDone;
36 class gp_Pnt2d;
37 class gp_Lin2d;
38 class gp_Circ2d;
39 class GccEnt_QualifiedCirc;
40
41
42 //! This class implements the algorithms used to
43 //! create 2d lines tangent to a circle or a point and
44 //! perpendicular to a line or a circle.
45 //! Describes functions for building a 2D line perpendicular
46 //! to a line and:
47 //! -   tangential to a circle, or
48 //! -   passing through a point.
49 //! A Lin2dTanPer object provides a framework for:
50 //! -   defining the construction of 2D line(s),
51 //! -   implementing the construction algorithm, and
52 //! -   consulting the result(s).
53 class GccAna_Lin2dTanPer 
54 {
55 public:
56
57   DEFINE_STANDARD_ALLOC
58
59   
60   //! This method implements the algorithms used to
61   //! create 2d lines passing through a point and
62   //! perpendicular to a line.
63   Standard_EXPORT GccAna_Lin2dTanPer(const gp_Pnt2d& ThePnt, const gp_Lin2d& TheLin);
64   
65   //! This method implements the algorithms used to
66   //! create 2d lines passing through a point and
67   //! perpendicular to a circle.
68   Standard_EXPORT GccAna_Lin2dTanPer(const gp_Pnt2d& ThePnt, const gp_Circ2d& TheCircle);
69   
70   //! This method implements the algorithms used to
71   //! create 2d lines tangent to a circle and
72   //! perpendicular to a line.
73   Standard_EXPORT GccAna_Lin2dTanPer(const GccEnt_QualifiedCirc& Qualified1, const gp_Lin2d& TheLin);
74   
75   //! This method implements the algorithms used to
76   //! create 2d lines tangent to a circle and
77   //! perpendicular to a circle.
78   Standard_EXPORT GccAna_Lin2dTanPer(const GccEnt_QualifiedCirc& Qualified1, const gp_Circ2d& TheCircle);
79   
80   //! Returns True if the algorithm succeeded.
81   Standard_EXPORT Standard_Boolean IsDone() const;
82   
83   //! Returns the number of solutions.
84   //! Raises NotDone if the construction algorithm didn't succeed.
85   Standard_EXPORT Standard_Integer NbSolutions() const;
86   
87   //! Returns the qualifier Qualif1 of the tangency argument
88   //! for the solution of index Index computed by this algorithm.
89   //! The returned qualifier is:
90   //! -   that specified at the start of construction when the
91   //! solutions are defined as enclosing or outside with
92   //! respect to the argument, or
93   //! -   that computed during construction (i.e. enclosing or
94   //! outside) when the solutions are defined as unqualified
95   //! with respect to the argument, or
96   //! -   GccEnt_noqualifier if the tangency argument is a point.
97   //! Exceptions
98   //! Standard_OutOfRange if Index is less than zero or
99   //! greater than the number of solutions computed by this algorithm.
100   //! StdFail_NotDone if the construction fails.
101   Standard_EXPORT void WhichQualifier (const Standard_Integer Index, GccEnt_Position& Qualif1) const;
102   
103   //! Returns the solution number Index and raises OutOfRange
104   //! exception if Index is greater than the number of solutions.
105   //! Be careful: the Index is only a way to get all the
106   //! solutions, but is not associated to those outside the
107   //! context of the algorithm-object.
108   //! Raises NotDone if the construction algorithm
109   //! didn't succeed.
110   //! It raises OutOfRange if Index is greater than the
111   //! number of solutions.
112   Standard_EXPORT gp_Lin2d ThisSolution (const Standard_Integer Index) const;
113   
114   //! Returns informations about the tangency point between the
115   //! result number Index and the first argument.
116   //! ParSol is the intrinsic parameter of the point on the
117   //! solution curv.
118   //! ParArg is the intrinsic parameter of the point on the
119   //! argument curv.
120   //! If the first argument is a point ParArg is equal zero.
121   //! raises NotDone if the construction algorithm didn't succeed.
122   //! It raises OutOfRange if Index is greater than the
123   //! number of solutions.
124   Standard_EXPORT void Tangency1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& Pnt) const;
125   
126   //! Returns informations about the intersection between the
127   //! solution number Index and the second argument.
128   //! It returns the first intersection in a case of
129   //! Lin2dTanPer which is perpendicular to a circle .
130   //! ParSol is the intrinsic parameter of the point on the
131   //! solution curv.
132   //! ParArg is the intrinsic parameter of the point on the
133   //! argument curv. Raises NotDone if the construction algorithm
134   //! didn't succeed.
135   //! It raises OutOfRange if Index is greater than the
136   //! number of solutions.
137   Standard_EXPORT void Intersection2 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const;
138
139
140
141
142 protected:
143
144
145
146
147
148 private:
149
150
151
152   Standard_Boolean WellDone;
153   Standard_Integer NbrSol;
154   TColgp_Array1OfLin2d linsol;
155   GccEnt_Array1OfPosition qualifier1;
156   TColgp_Array1OfPnt2d pnttg1sol;
157   TColgp_Array1OfPnt2d pntint2sol;
158   TColStd_Array1OfReal par1sol;
159   TColStd_Array1OfReal par2sol;
160   TColStd_Array1OfReal pararg1;
161   TColStd_Array1OfReal pararg2;
162
163
164 };
165
166
167
168
169
170
171
172 #endif // _GccAna_Lin2dTanPer_HeaderFile