|
||||
File indexing completed on 2025-01-18 10:03:33
0001 // Created on: 1994-08-18 0002 // Created by: Laurent PAINNOT 0003 // Copyright (c) 1994-1999 Matra Datavision 0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0005 // 0006 // This file is part of Open CASCADE Technology software library. 0007 // 0008 // This library is free software; you can redistribute it and/or modify it under 0009 // the terms of the GNU Lesser General Public License version 2.1 as published 0010 // by the Free Software Foundation, with special exception defined in the file 0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0012 // distribution for complete text of the license and disclaimer of any warranty. 0013 // 0014 // Alternatively, this file may be used under the terms of Open CASCADE 0015 // commercial license or contractual agreement. 0016 0017 #ifndef _Geom2dAPI_Interpolate_HeaderFile 0018 #define _Geom2dAPI_Interpolate_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <TColgp_HArray1OfPnt2d.hxx> 0025 #include <TColgp_HArray1OfVec2d.hxx> 0026 #include <TColStd_HArray1OfBoolean.hxx> 0027 #include <TColStd_HArray1OfReal.hxx> 0028 #include <TColgp_Array1OfVec2d.hxx> 0029 class Geom2d_BSplineCurve; 0030 class gp_Vec2d; 0031 0032 0033 //! This class is used to interpolate a BsplineCurve 0034 //! passing through an array of points, with a C2 0035 //! Continuity if tangency is not requested at the point. 0036 //! If tangency is requested at the point the continuity will 0037 //! be C1. If Perodicity is requested the curve will be closed 0038 //! and the junction will be the first point given. The curve will than be only C1 0039 //! The curve is defined by a table of points through which it passes, and if required 0040 //! by a parallel table of reals which gives the value of the parameter of each point through 0041 //! which the resulting BSpline curve passes, and by vectors tangential to these points. 0042 //! An Interpolate object provides a framework for: defining the constraints of the BSpline curve, 0043 //! - implementing the interpolation algorithm, and consulting the results. 0044 class Geom2dAPI_Interpolate 0045 { 0046 public: 0047 0048 DEFINE_STANDARD_ALLOC 0049 0050 0051 //! Tolerance is to check if the points are not too close to one an other 0052 //! It is also used to check if the tangent vector is not too small. 0053 //! There should be at least 2 points 0054 //! if PeriodicFlag is True then the curve will be periodic. 0055 Standard_EXPORT Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& Points, 0056 const Standard_Boolean PeriodicFlag, 0057 const Standard_Real Tolerance); 0058 0059 //! if PeriodicFlag is True then the curve will be periodic 0060 //! Warning: 0061 //! There should be as many parameters as there are points 0062 //! except if PeriodicFlag is True : then there should be one more 0063 //! parameter to close the curve 0064 Standard_EXPORT Geom2dAPI_Interpolate(const Handle(TColgp_HArray1OfPnt2d)& Points, 0065 const Handle(TColStd_HArray1OfReal)& Parameters, 0066 const Standard_Boolean PeriodicFlag, 0067 const Standard_Real Tolerance); 0068 0069 //! Assigns this constrained BSpline curve to be 0070 //! tangential to vectors InitialTangent and FinalTangent 0071 //! at its first and last points respectively (i.e. 0072 //! the first and last points of the table of 0073 //! points through which the curve passes, as 0074 //! defined at the time of initialization). 0075 //! <Scale> - boolean flag defining whether tangent vectors are to 0076 //! be scaled according to derivatives of lagrange interpolation. 0077 Standard_EXPORT void Load(const gp_Vec2d& InitialTangent, 0078 const gp_Vec2d& FinalTangent, 0079 const Standard_Boolean Scale = Standard_True); 0080 0081 //! Assigns this constrained BSpline curve to be 0082 //! tangential to vectors defined in the table Tangents, 0083 //! which is parallel to the table of points 0084 //! through which the curve passes, as 0085 //! defined at the time of initialization. Vectors 0086 //! in the table Tangents are defined only if 0087 //! the flag given in the parallel table 0088 //! TangentFlags is true: only these vectors 0089 //! are set as tangency constraints. 0090 //! <Scale> - boolean flag defining whether tangent vectors are to 0091 //! be scaled according to derivatives of lagrange interpolation. 0092 Standard_EXPORT void Load(const TColgp_Array1OfVec2d& Tangents, 0093 const Handle(TColStd_HArray1OfBoolean)& TangentFlags, 0094 const Standard_Boolean Scale = Standard_True); 0095 0096 //! Clears all tangency constraints on this 0097 //! constrained BSpline curve (as initialized by the function Load). 0098 Standard_EXPORT void ClearTangents(); 0099 0100 //! Computes the constrained BSpline curve. Use the function IsDone to verify that the 0101 //! computation is successful, and then the function Curve to obtain the result. 0102 Standard_EXPORT void Perform(); 0103 0104 //! Returns the computed BSpline curve. Raises StdFail_NotDone if the interpolation fails. 0105 Standard_EXPORT const Handle(Geom2d_BSplineCurve)& Curve() const; 0106 Standard_EXPORT operator Handle(Geom2d_BSplineCurve)() const; 0107 0108 //! Returns true if the constrained BSpline curve is successfully constructed. 0109 //! Note: in this case, the result is given by the function Curve. 0110 Standard_EXPORT Standard_Boolean IsDone() const; 0111 0112 0113 0114 0115 protected: 0116 0117 0118 0119 0120 0121 private: 0122 0123 0124 //! Interpolates in a non periodic fashion 0125 Standard_EXPORT void PerformNonPeriodic(); 0126 0127 //! Interpolates in a C1 periodic fashion 0128 Standard_EXPORT void PerformPeriodic(); 0129 0130 0131 Standard_Real myTolerance; 0132 Handle(TColgp_HArray1OfPnt2d) myPoints; 0133 Standard_Boolean myIsDone; 0134 Handle(Geom2d_BSplineCurve) myCurve; 0135 Handle(TColgp_HArray1OfVec2d) myTangents; 0136 Handle(TColStd_HArray1OfBoolean) myTangentFlags; 0137 Handle(TColStd_HArray1OfReal) myParameters; 0138 Standard_Boolean myPeriodic; 0139 Standard_Boolean myTangentRequest; 0140 0141 0142 }; 0143 0144 0145 0146 0147 0148 0149 0150 #endif // _Geom2dAPI_Interpolate_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |