42cf5bc1 |
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_Lin2dBisec_HeaderFile |
18 | #define _GccAna_Lin2dBisec_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 <TColgp_Array1OfPnt2d.hxx> |
28 | #include <TColStd_Array1OfReal.hxx> |
29 | #include <Standard_Real.hxx> |
30 | class Standard_OutOfRange; |
31 | class StdFail_NotDone; |
32 | class gp_Lin2d; |
33 | class gp_Pnt2d; |
34 | |
35 | |
36 | //! Describes functions for building bisecting lines between two 2D lines. |
37 | //! A bisecting line between two lines is such that each of its |
38 | //! points is at the same distance from the two lines. |
39 | //! If the two lines are secant, there are two orthogonal |
40 | //! bisecting lines which share the angles made by the two |
41 | //! straight lines in two equal parts. If D1 and D2 are the |
42 | //! unit vectors of the two straight lines, those of the two |
43 | //! bisecting lines are collinear with the following vectors: |
44 | //! - D1 + D2 for the "internal" bisecting line, |
45 | //! - D1 - D2 for the "external" bisecting line. |
46 | //! If the two lines are parallel, the (unique) bisecting line is |
47 | //! the straight line equidistant from the two straight lines. If |
48 | //! the two straight lines are coincident, the algorithm |
49 | //! returns the first straight line as the solution. |
50 | //! A Lin2dTanObl object provides a framework for: |
51 | //! - defining the construction of the bisecting lines, |
52 | //! - implementing the construction algorithm, and |
53 | //! - consulting the result. |
54 | class GccAna_Lin2dBisec |
55 | { |
56 | public: |
57 | |
58 | DEFINE_STANDARD_ALLOC |
59 | |
60 | |
61 | //! Constructs bisecting lines between the two lines Lin1 and Lin2. |
62 | Standard_EXPORT GccAna_Lin2dBisec(const gp_Lin2d& Lin1, const gp_Lin2d& Lin2); |
63 | |
64 | //! Returns True when the algorithm succeded. |
65 | Standard_EXPORT Standard_Boolean IsDone() const; |
66 | |
67 | //! Returns the number of solutions and raise NotDone if |
68 | //! the constructor wasn't called before. |
69 | Standard_EXPORT Standard_Integer NbSolutions() const; |
70 | |
71 | //! Returns the solution number Index . |
72 | //! The first solution is the inside one and the second is the |
73 | //! outside one. |
74 | //! For the first solution the direction is D1+D2 (D1 is |
75 | //! the direction of the first argument and D2 the |
76 | //! direction of the second argument). |
77 | //! For the second solution the direction is D1-D2. |
78 | //! Raises NotDone if the construction algorithm |
79 | //! didn't succeed. |
80 | //! It raises OutOfRange if Index is greater than the |
81 | //! number of solutions. |
82 | Standard_EXPORT gp_Lin2d ThisSolution (const Standard_Integer Index) const; |
83 | |
84 | //! Returns informations about the intersection point between |
85 | //! the result number Index and the first argument. |
86 | //! Raises NotDone if the construction algorithm didn't succeed. |
87 | //! It raises OutOfRange if Index is greater than the |
88 | //! number of solutions. |
89 | Standard_EXPORT void Intersection1 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
90 | |
91 | //! Returns informations about the intersection point between |
92 | //! the result number Index and the second argument. |
93 | //! Raises NotDone if the construction algorithm |
94 | //! didn't succeed. |
95 | //! It raises OutOfRange if Index is greater than the |
96 | //! number of solutions. |
97 | Standard_EXPORT void Intersection2 (const Standard_Integer Index, Standard_Real& ParSol, Standard_Real& ParArg, gp_Pnt2d& PntSol) const; |
98 | |
99 | |
100 | |
101 | |
102 | protected: |
103 | |
104 | |
105 | |
106 | |
107 | |
108 | private: |
109 | |
110 | |
111 | |
112 | Standard_Boolean WellDone; |
113 | Standard_Integer NbrSol; |
114 | TColgp_Array1OfLin2d linsol; |
115 | TColgp_Array1OfPnt2d pntint1sol; |
116 | TColgp_Array1OfPnt2d pntint2sol; |
117 | TColStd_Array1OfReal par1sol; |
118 | TColStd_Array1OfReal par2sol; |
119 | TColStd_Array1OfReal pararg1; |
120 | TColStd_Array1OfReal pararg2; |
121 | |
122 | |
123 | }; |
124 | |
125 | |
126 | |
127 | |
128 | |
129 | |
130 | |
131 | #endif // _GccAna_Lin2dBisec_HeaderFile |