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 20 #include <CPnts_AbscissaPoint.hxx> 21 22 class StdFail_NotDone; 23 class Standard_ConstructionError; 24 class Adaptor3d_Curve; 25 class Adaptor2d_Curve2d; 26 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>. 44 Standard_EXPORT static Standard_Real Length (const Adaptor3d_Curve& C); 45 46 //! Computes the length of the Curve <C>. 47 Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C); 48 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); 51 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); 54 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); 57 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); 60 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); 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. 70 Standard_EXPORT static Standard_Real Length (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2, const Standard_Real Tol); 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>. 76 Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0); 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. 81 Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real Tol, const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0); 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. 86 Standard_EXPORT GCPnts_AbscissaPoint(const Standard_Real Tol, const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0); 87 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); 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 97 Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor3d_Curve& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui); 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 104 Standard_EXPORT GCPnts_AbscissaPoint(const Adaptor2d_Curve2d& C, const Standard_Real Abscissa, const Standard_Real U0, const Standard_Real Ui); 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 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); 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 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); 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. IsDone() const124 Standard_Boolean IsDone () const 125 { 126 return myComputer.IsDone (); 127 } 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. Parameter() const134 Standard_Real Parameter () const 135 { 136 return myComputer.Parameter (); 137 } 138 139 private: 140 CPnts_AbscissaPoint myComputer; 141 }; 142 143 #endif // _GCPnts_AbscissaPoint_HeaderFile 144