42cf5bc1 |
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 |
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 _GCPnts_AbscissaPoint_HeaderFile |
18 | #define _GCPnts_AbscissaPoint_HeaderFile |
19 | |
42cf5bc1 |
20 | #include <CPnts_AbscissaPoint.hxx> |
9bf3ef83 |
21 | |
42cf5bc1 |
22 | class StdFail_NotDone; |
23 | class Standard_ConstructionError; |
24 | class Adaptor3d_Curve; |
25 | class Adaptor2d_Curve2d; |
26 | |
42cf5bc1 |
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 |
37 | { |
38 | public: |
39 | |
40 | DEFINE_STANDARD_ALLOC |
41 | |
42 | |
43 | //! Computes the length of the Curve <C>. |
37782ec2 |
44 | Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C); |
42cf5bc1 |
45 | |
46 | //! Computes the length of the Curve <C>. |
37782ec2 |
47 | Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C); |
42cf5bc1 |
48 | |
49 | //! Computes the length of the Curve <C> with the given tolerance. |
37782ec2 |
50 | Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real Tol); |
42cf5bc1 |
51 | |
52 | //! Computes the length of the Curve <C> with the given tolerance. |
37782ec2 |
53 | Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real Tol); |
42cf5bc1 |
54 | |
55 | //! Computes the length of the Curve <C>. |
37782ec2 |
56 | Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2); |
42cf5bc1 |
57 | |
58 | //! Computes the length of the Curve <C>. |
37782ec2 |
59 | Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2); |
42cf5bc1 |
60 | |
61 | //! Computes the length of the Curve <C> with the given tolerance. |
37782ec2 |
62 | Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol); |
42cf5bc1 |
63 | |
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). |
68 | //! Warning |
69 | //! The function IsDone will return the value false after the use of this function. |
37782ec2 |
70 | Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol); |
42cf5bc1 |
71 | |
72 | Standard_EXPORT GCPnts_AbscissaPoint(); |
73 | |
74 | //! the algorithm computes a point on a curve <Curve> at the |
75 | //! distance <Abscissa> from the point of parameter <U0>. |
37782ec2 |
76 | Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0); |
42cf5bc1 |
77 | |
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. |
37782ec2 |
81 | Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real Tol, const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0); |
42cf5bc1 |
82 | |
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. |
37782ec2 |
86 | Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real Tol, const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0); |
42cf5bc1 |
87 | |
88 | //! the algorithm computes a point on a curve <Curve> at the |
89 | //! distance <Abscissa> from the point of parameter <U0>. |
37782ec2 |
90 | Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0); |
42cf5bc1 |
91 | |
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 |
96 | //! solution |
37782ec2 |
97 | Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui); |
42cf5bc1 |
98 | |
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 |
103 | //! solution |
37782ec2 |
104 | Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui); |
42cf5bc1 |
105 | |
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 |
110 | //! solution |
37782ec2 |
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); |
42cf5bc1 |
112 | |
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 |
117 | //! solution |
37782ec2 |
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); |
42cf5bc1 |
119 | |
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. |
9bf3ef83 |
124 | Standard_Boolean IsDone () const |
125 | { |
126 | return myComputer.IsDone (); |
127 | } |
42cf5bc1 |
128 | |
129 | //! Returns the parameter on the curve of the point |
130 | //! solution of this algorithm. |
131 | //! Exceptions |
132 | //! StdFail_NotDone if the computation was not |
133 | //! successful, or was not done. |
9bf3ef83 |
134 | Standard_Real Parameter () const |
135 | { |
136 | return myComputer.Parameter (); |
137 | } |
42cf5bc1 |
138 | |
139 | private: |
42cf5bc1 |
140 | CPnts_AbscissaPoint myComputer; |
42cf5bc1 |
141 | }; |
142 | |
42cf5bc1 |
143 | #endif // _GCPnts_AbscissaPoint_HeaderFile |