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