1 // Created on: 1991-07-15
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 _CPnts_AbscissaPoint_HeaderFile
18 #define _CPnts_AbscissaPoint_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Real.hxx>
26 #include <CPnts_MyRootFunction.hxx>
27 class StdFail_NotDone;
28 class Standard_ConstructionError;
29 class Adaptor3d_Curve;
30 class Adaptor2d_Curve2d;
33 //! the algorithm computes a point on a curve at a given
34 //! distance from another point on the curve
36 //! We can instantiates with
37 //! Curve from Adaptor3d, Pnt from gp, Vec from gp
40 //! Curve2d from Adaptor2d, Pnt2d from gp, Vec2d from gp
41 class CPnts_AbscissaPoint
48 //! Computes the length of the Curve <C>.
49 Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C);
51 //! Computes the length of the Curve <C>.
52 Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C);
54 //! Computes the length of the Curve <C> with the given tolerance.
55 Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real Tol);
57 //! Computes the length of the Curve <C> with the given tolerance.
58 Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real Tol);
60 //! Computes the length of the Curve <C> between <U1> and <U2>.
61 Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2);
63 //! Computes the length of the Curve <C> between <U1> and <U2>.
64 Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2);
66 //! Computes the length of the Curve <C> between <U1> and <U2> with the given tolerance.
67 Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol);
69 //! Computes the length of the Curve <C> between <U1> and <U2> with the given tolerance.
70 //! creation of a indefinite AbscissaPoint.
71 Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol);
73 Standard_EXPORT CPnts_AbscissaPoint();
75 //! the algorithm computes a point on a curve <Curve> at the
76 //! distance <Abscissa> from the point of parameter <U0>.
77 //! <Resolution> is the error allowed in the computation.
78 //! The computed point can be outside of the curve 's bounds.
79 Standard_EXPORT CPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Resolution);
81 //! the algorithm computes a point on a curve <Curve> at the
82 //! distance <Abscissa> from the point of parameter <U0>.
83 //! <Resolution> is the error allowed in the computation.
84 //! The computed point can be outside of the curve 's bounds.
85 Standard_EXPORT CPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Resolution);
87 //! the algorithm computes a point on a curve <Curve> at the
88 //! distance <Abscissa> from the point of parameter <U0>.
89 //! <Ui> is the starting value used in the iterative process
90 //! which find the solution, it must be closed to the final
92 //! <Resolution> is the error allowed in the computation.
93 //! The computed point can be outside of the curve 's bounds.
94 Standard_EXPORT CPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Resolution);
96 //! the algorithm computes a point on a curve <Curve> at the
97 //! distance <Abscissa> from the point of parameter <U0>.
98 //! <Ui> is the starting value used in the iterative process
99 //! which find the solution, it must be closed to the final
101 //! <Resolution> is the error allowed in the computation.
102 //! The computed point can be outside of the curve 's bounds.
103 Standard_EXPORT CPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Resolution);
105 //! Initializes the resolution function with <C>.
106 Standard_EXPORT void Init (const Adaptor3d_Curve& C);
108 //! Initializes the resolution function with <C>.
109 Standard_EXPORT void Init (const Adaptor2d_Curve2d& C);
111 //! Initializes the resolution function with <C>.
112 Standard_EXPORT void Init (const Adaptor3d_Curve& C, const Standard_Real Tol);
114 //! Initializes the resolution function with <C>.
115 Standard_EXPORT void Init (const Adaptor2d_Curve2d& C, const Standard_Real Tol);
117 //! Initializes the resolution function with <C>
118 //! between U1 and U2.
119 Standard_EXPORT void Init (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2);
121 //! Initializes the resolution function with <C>
122 //! between U1 and U2.
123 Standard_EXPORT void Init (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2);
125 //! Initializes the resolution function with <C>
126 //! between U1 and U2.
127 Standard_EXPORT void Init (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol);
129 //! Initializes the resolution function with <C>
130 //! between U1 and U2.
131 Standard_EXPORT void Init (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol);
133 //! Computes the point at the distance <Abscissa> of
135 //! U0 is the parameter of the point from which the distance
137 Standard_EXPORT void Perform (const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Resolution);
139 //! Computes the point at the distance <Abscissa> of
141 //! U0 is the parameter of the point from which the distance
142 //! is measured and Ui is the starting value for the iterative
143 //! process (should be close to the final solution).
144 Standard_EXPORT void Perform (const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Resolution);
146 //! Computes the point at the distance <Abscissa> of
147 //! the curve; performs more appropriate tolerance managment;
148 //! to use this method in right way it is necessary to call
149 //! empty consructor. then call method Init with
150 //! Tolerance = Resolution, then call AdvPermorm.
151 //! U0 is the parameter of the point from which the distance
152 //! is measured and Ui is the starting value for the iterative
153 //! process (should be close to the final solution).
154 Standard_EXPORT void AdvPerform (const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Resolution);
156 //! True if the computation was successful, False otherwise.
157 Standard_Boolean IsDone() const;
159 //! Returns the parameter of the solution.
160 Standard_Real Parameter() const;
162 //! Enforce the solution, used by GCPnts.
163 void SetParameter (const Standard_Real P);
178 Standard_Boolean myDone;
180 Standard_Real myParam;
181 Standard_Real myUMin;
182 Standard_Real myUMax;
183 CPnts_MyRootFunction myF;
189 #include <CPnts_AbscissaPoint.lxx>
195 #endif // _CPnts_AbscissaPoint_HeaderFile