42cf5bc1 |
1 | // Created on: 1994-01-10 |
2 | // Created by: Yves FRICAUD |
3 | // Copyright (c) 1994-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 _Bisector_BisecPC_HeaderFile |
18 | #define _Bisector_BisecPC_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
42cf5bc1 |
21 | |
22 | #include <gp_Pnt2d.hxx> |
42cf5bc1 |
23 | #include <TColStd_SequenceOfReal.hxx> |
24 | #include <Standard_Integer.hxx> |
42cf5bc1 |
25 | #include <Bisector_Curve.hxx> |
26 | #include <GeomAbs_Shape.hxx> |
27 | class Geom2d_Curve; |
42cf5bc1 |
28 | class Geom2d_Geometry; |
29 | class gp_Trsf2d; |
30 | class gp_Vec2d; |
31 | |
32 | |
33 | class Bisector_BisecPC; |
34 | DEFINE_STANDARD_HANDLE(Bisector_BisecPC, Bisector_Curve) |
35 | |
36 | //! Provides the bisector between a point and a curve. |
37 | //! the curvature on the curve has to be monoton. |
21c7c457 |
38 | //! the point can't be on the curve exept at the extremities. |
42cf5bc1 |
39 | class Bisector_BisecPC : public Bisector_Curve |
40 | { |
41 | |
42 | public: |
43 | |
44 | |
45 | Standard_EXPORT Bisector_BisecPC(); |
46 | |
47 | //! Constructs the bisector between the point <P> and |
48 | //! the curve <Cu>. |
49 | //! <Side> = 1. if the bisector curve is on the Left of <Cu> |
50 | //! else <Side> = -1. |
51 | //! <DistMax> is used to trim the bisector.The distance |
52 | //! between the points of the bisector and <Cu> is smaller |
53 | //! than <DistMax>. |
54 | Standard_EXPORT Bisector_BisecPC(const Handle(Geom2d_Curve)& Cu, const gp_Pnt2d& P, const Standard_Real Side, const Standard_Real DistMax = 500); |
55 | |
56 | //! Constructs the bisector between the point <P> and |
57 | //! the curve <Cu> Trimmed by <UMin> and <UMax> |
58 | //! <Side> = 1. if the bisector curve is on the Left of <Cu> |
59 | //! else <Side> = -1. |
60 | //! Warning: the bisector is supposed all over defined between |
61 | //! <UMin> and <UMax>. |
62 | Standard_EXPORT Bisector_BisecPC(const Handle(Geom2d_Curve)& Cu, const gp_Pnt2d& P, const Standard_Real Side, const Standard_Real UMin, const Standard_Real UMax); |
63 | |
64 | //! Construct the bisector between the point <P> and |
65 | //! the curve <Cu>. |
66 | //! <Side> = 1. if the bisector curve is on the Left of <Cu> |
67 | //! else <Side> = -1. |
68 | //! <DistMax> is used to trim the bisector.The distance |
69 | //! between the points of the bisector and <Cu> is smaller |
70 | //! than <DistMax>. |
71 | Standard_EXPORT void Perform (const Handle(Geom2d_Curve)& Cu, const gp_Pnt2d& P, const Standard_Real Side, const Standard_Real DistMax = 500); |
72 | |
73 | //! Returns True if the bisector is extended at start. |
79104795 |
74 | Standard_EXPORT Standard_Boolean IsExtendAtStart() const Standard_OVERRIDE; |
42cf5bc1 |
75 | |
76 | //! Returns True if the bisector is extended at end. |
79104795 |
77 | Standard_EXPORT Standard_Boolean IsExtendAtEnd() const Standard_OVERRIDE; |
42cf5bc1 |
78 | |
79 | |
80 | //! Changes the direction of parametrization of <me>. |
81 | //! The orientation of the curve is modified. If the curve |
82 | //! is bounded the StartPoint of the initial curve becomes the |
83 | //! EndPoint of the reversed curve and the EndPoint of the initial |
84 | //! curve becomes the StartPoint of the reversed curve. |
79104795 |
85 | Standard_EXPORT void Reverse() Standard_OVERRIDE; |
42cf5bc1 |
86 | |
87 | //! Returns the parameter on the reversed curve for |
88 | //! the point of parameter U on <me>. |
79104795 |
89 | Standard_EXPORT Standard_Real ReversedParameter (const Standard_Real U) const Standard_OVERRIDE; |
42cf5bc1 |
90 | |
79104795 |
91 | Standard_EXPORT Handle(Geom2d_Geometry) Copy() const Standard_OVERRIDE; |
42cf5bc1 |
92 | |
93 | |
94 | //! Transformation of a geometric object. This tansformation |
95 | //! can be a translation, a rotation, a symmetry, a scaling |
96 | //! or a complex transformation obtained by combination of |
97 | //! the previous elementaries transformations. |
79104795 |
98 | Standard_EXPORT void Transform (const gp_Trsf2d& T) Standard_OVERRIDE; |
42cf5bc1 |
99 | |
100 | //! Returns the order of continuity of the curve. |
101 | //! Raised if N < 0. |
79104795 |
102 | Standard_EXPORT Standard_Boolean IsCN (const Standard_Integer N) const Standard_OVERRIDE; |
42cf5bc1 |
103 | |
104 | //! Value of the first parameter. |
79104795 |
105 | Standard_EXPORT Standard_Real FirstParameter() const Standard_OVERRIDE; |
42cf5bc1 |
106 | |
107 | //! Value of the last parameter. |
79104795 |
108 | Standard_EXPORT Standard_Real LastParameter() const Standard_OVERRIDE; |
42cf5bc1 |
109 | |
79104795 |
110 | Standard_EXPORT GeomAbs_Shape Continuity() const Standard_OVERRIDE; |
42cf5bc1 |
111 | |
112 | //! If necessary, breaks the curve in intervals of |
113 | //! continuity <C1>. And returns the number of |
114 | //! intervals. |
79104795 |
115 | Standard_EXPORT Standard_Integer NbIntervals() const Standard_OVERRIDE; |
42cf5bc1 |
116 | |
117 | //! Returns the first parameter of the current |
118 | //! interval. |
79104795 |
119 | Standard_EXPORT Standard_Real IntervalFirst (const Standard_Integer Index) const Standard_OVERRIDE; |
42cf5bc1 |
120 | |
121 | //! Returns the last parameter of the current |
122 | //! interval. |
79104795 |
123 | Standard_EXPORT Standard_Real IntervalLast (const Standard_Integer Index) const Standard_OVERRIDE; |
42cf5bc1 |
124 | |
125 | Standard_EXPORT GeomAbs_Shape IntervalContinuity() const; |
126 | |
79104795 |
127 | Standard_EXPORT Standard_Boolean IsClosed() const Standard_OVERRIDE; |
42cf5bc1 |
128 | |
79104795 |
129 | Standard_EXPORT Standard_Boolean IsPeriodic() const Standard_OVERRIDE; |
42cf5bc1 |
130 | |
131 | //! Returns the distance between the point of |
132 | //! parameter U on <me> and my point or my curve. |
133 | Standard_EXPORT Standard_Real Distance (const Standard_Real U) const; |
134 | |
79104795 |
135 | Standard_EXPORT void D0 (const Standard_Real U, gp_Pnt2d& P) const Standard_OVERRIDE; |
42cf5bc1 |
136 | |
79104795 |
137 | Standard_EXPORT void D1 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V) const Standard_OVERRIDE; |
42cf5bc1 |
138 | |
79104795 |
139 | Standard_EXPORT void D2 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2) const Standard_OVERRIDE; |
42cf5bc1 |
140 | |
79104795 |
141 | Standard_EXPORT void D3 (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const Standard_OVERRIDE; |
42cf5bc1 |
142 | |
79104795 |
143 | Standard_EXPORT gp_Vec2d DN (const Standard_Real U, const Standard_Integer N) const Standard_OVERRIDE; |
42cf5bc1 |
144 | |
145 | Standard_EXPORT void Dump (const Standard_Integer Deep = 0, const Standard_Integer Offset = 0) const; |
146 | |
147 | //! Returns the parameter on the curve1 of the projection |
148 | //! of the point of parameter U on <me>. |
149 | Standard_EXPORT Standard_Real LinkBisCurve (const Standard_Real U) const; |
150 | |
151 | //! Returns the reciproque of LinkBisCurve. |
152 | Standard_EXPORT Standard_Real LinkCurveBis (const Standard_Real U) const; |
153 | |
154 | //! Returns the parameter on <me> corresponding to <P>. |
79104795 |
155 | Standard_EXPORT Standard_Real Parameter (const gp_Pnt2d& P) const Standard_OVERRIDE; |
42cf5bc1 |
156 | |
157 | //! Returns <True> if the bisector is empty. |
158 | Standard_EXPORT Standard_Boolean IsEmpty() const; |
159 | |
160 | |
161 | |
162 | |
92efcf78 |
163 | DEFINE_STANDARD_RTTIEXT(Bisector_BisecPC,Bisector_Curve) |
42cf5bc1 |
164 | |
165 | protected: |
166 | |
167 | |
168 | |
169 | |
170 | private: |
171 | |
172 | |
173 | Standard_EXPORT void Values (const Standard_Real U, const Standard_Integer N, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const; |
174 | |
175 | Standard_EXPORT void Extension (const Standard_Real U, gp_Pnt2d& P, gp_Vec2d& V1, gp_Vec2d& V2, gp_Vec2d& V3) const; |
176 | |
177 | //! Computes the interval where the bisector is defined. |
178 | Standard_EXPORT void ComputeIntervals(); |
179 | |
180 | Standard_EXPORT void CuspFilter(); |
181 | |
182 | Standard_EXPORT Standard_Real SearchBound (const Standard_Real U1, const Standard_Real U2) const; |
183 | |
184 | Standard_EXPORT void Init (const Handle(Geom2d_Curve)& Curve, const gp_Pnt2d& Point, const Standard_Real Sign, const TColStd_SequenceOfReal& StartIntervals, const TColStd_SequenceOfReal& EndIntervals, const Standard_Integer BisInterval, const Standard_Integer CurrentInterval, const Standard_Real ShiftParameter, const Standard_Real DistMax, const Standard_Boolean IsEmpty, const Standard_Boolean IsConvex, const Standard_Boolean ExtensionStart, const Standard_Boolean ExtensionEnd, const gp_Pnt2d& PointStartBis, const gp_Pnt2d& PointEndBis); |
185 | |
186 | Handle(Geom2d_Curve) curve; |
187 | gp_Pnt2d point; |
188 | Standard_Real sign; |
189 | TColStd_SequenceOfReal startIntervals; |
190 | TColStd_SequenceOfReal endIntervals; |
191 | Standard_Integer bisInterval; |
192 | Standard_Integer currentInterval; |
193 | Standard_Real shiftParameter; |
194 | Standard_Real distMax; |
195 | Standard_Boolean isEmpty; |
196 | Standard_Boolean isConvex; |
197 | Standard_Boolean extensionStart; |
198 | Standard_Boolean extensionEnd; |
199 | gp_Pnt2d pointStartBis; |
200 | gp_Pnt2d pointEndBis; |
201 | |
202 | |
203 | }; |
204 | |
205 | |
206 | |
207 | |
208 | |
209 | |
210 | |
211 | #endif // _Bisector_BisecPC_HeaderFile |