1 // Created on: 1992-03-25
2 // Created by: Herve LEGRAND
3 // Copyright (c) 1992-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 _GCPnts_AbscissaPoint_HeaderFile
18 #define _GCPnts_AbscissaPoint_HeaderFile
20 #include <CPnts_AbscissaPoint.hxx>
22 class StdFail_NotDone;
23 class Standard_ConstructionError;
24 class Adaptor3d_Curve;
25 class Adaptor2d_Curve2d;
27 //! Provides an algorithm to compute a point on a curve
28 //! situated at a given distance from another point on the
29 //! curve, the distance being measured along the curve
30 //! (curvilinear abscissa on the curve).
31 //! This algorithm is also used to compute the length of a curve.
32 //! An AbscissaPoint object provides a framework for:
33 //! - defining the point to compute
34 //! - implementing the construction algorithm
35 //! - consulting the result.
36 class GCPnts_AbscissaPoint
43 //! Computes the length of the Curve <C>.
44 Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C);
46 //! Computes the length of the Curve <C>.
47 Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C);
49 //! Computes the length of the Curve <C> with the given tolerance.
50 Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real Tol);
52 //! Computes the length of the Curve <C> with the given tolerance.
53 Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real Tol);
55 //! Computes the length of the Curve <C>.
56 Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2);
58 //! Computes the length of the Curve <C>.
59 Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2);
61 //! Computes the length of the Curve <C> with the given tolerance.
62 Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol);
64 //! Computes the length of the Curve <C> with the given tolerance.
65 //! Constructs an empty algorithm. This function is used
66 //! only for initializing a framework to compute the length
67 //! of a curve (or a series of curves).
69 //! The function IsDone will return the value false after the use of this function.
70 Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol);
72 Standard_EXPORT GCPnts_AbscissaPoint();
74 //! the algorithm computes a point on a curve <Curve> at the
75 //! distance <Abscissa> from the point of parameter <U0>.
76 Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0);
78 //! the algorithm computes a point on a curve <Curve> at
79 //! the distance <Abscissa> from the point of parameter
80 //! <U0> with the given tolerance.
81 Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real Tol, const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0);
83 //! the algorithm computes a point on a curve <Curve> at
84 //! the distance <Abscissa> from the point of parameter
85 //! <U0> with the given tolerance.
86 Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real Tol, const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0);
88 //! the algorithm computes a point on a curve <Curve> at the
89 //! distance <Abscissa> from the point of parameter <U0>.
90 Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0);
92 //! the algorithm computes a point on a curve <Curve> at the
93 //! distance <Abscissa> from the point of parameter <U0>.
94 //! <Ui> is the starting value used in the iterative process
95 //! which find the solution, it must be close to the final
97 Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui);
99 //! the algorithm computes a point on a curve <Curve> at the
100 //! distance <Abscissa> from the point of parameter <U0>.
101 //! <Ui> is the starting value used in the iterative process
102 //! which find the solution, it must be closed to the final
104 Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui);
106 //! the algorithm computes a point on a curve <Curve> at the
107 //! distance <Abscissa> from the point of parameter <U0>.
108 //! <Ui> is the starting value used in the iterative process
109 //! which find the solution, it must be close to the final
111 Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Tol);
113 //! the algorithm computes a point on a curve <Curve> at the
114 //! distance <Abscissa> from the point of parameter <U0>.
115 //! <Ui> is the starting value used in the iterative process
116 //! which find the solution, it must be close to the final
118 Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui, const Standard_Real Tol);
120 //! True if the computation was successful, False otherwise.
121 //! IsDone is a protection against:
122 //! - non-convergence of the algorithm
123 //! - querying the results before computation.
124 Standard_Boolean IsDone () const
126 return myComputer.IsDone ();
129 //! Returns the parameter on the curve of the point
130 //! solution of this algorithm.
132 //! StdFail_NotDone if the computation was not
133 //! successful, or was not done.
134 Standard_Real Parameter () const
136 return myComputer.Parameter ();
140 CPnts_AbscissaPoint myComputer;
143 #endif // _GCPnts_AbscissaPoint_HeaderFile