|
||||
File indexing completed on 2024-11-15 09:46:51
0001 // Created on: 2003-03-18 0002 // Created by: Oleg FEDYAEV 0003 // Copyright (c) 2003-2014 OPEN CASCADE SAS 0004 // 0005 // This file is part of Open CASCADE Technology software library. 0006 // 0007 // This library is free software; you can redistribute it and/or modify it under 0008 // the terms of the GNU Lesser General Public License version 2.1 as published 0009 // by the Free Software Foundation, with special exception defined in the file 0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0011 // distribution for complete text of the license and disclaimer of any warranty. 0012 // 0013 // Alternatively, this file may be used under the terms of Open CASCADE 0014 // commercial license or contractual agreement. 0015 0016 #ifndef _GeomLib_Tool_HeaderFile 0017 #define _GeomLib_Tool_HeaderFile 0018 0019 #include <Standard.hxx> 0020 #include <Standard_DefineAlloc.hxx> 0021 #include <Standard_Handle.hxx> 0022 0023 #include <Standard_Boolean.hxx> 0024 #include <Standard_Real.hxx> 0025 0026 class Geom_Curve; 0027 class Geom_Surface; 0028 class Geom2d_Curve; 0029 class Geom2dAdaptor_Curve; 0030 class gp_Lin2d; 0031 class gp_Pnt; 0032 class gp_Pnt2d; 0033 class gp_Vec2d; 0034 0035 //! Provides various methods with Geom2d and Geom curves and surfaces. 0036 //! The methods of this class compute the parameter(s) of a given point on a 0037 //! curve or a surface. To get the valid result the point must be located rather close 0038 //! to the curve (surface) or at least to allow getting unambiguous result 0039 //! (do not put point at center of circle...), 0040 //! but choice of "trust" distance between curve/surface and point is 0041 //! responsibility of user (parameter MaxDist). 0042 //! Return FALSE if the point is beyond the MaxDist 0043 //! limit or if computation fails. 0044 class GeomLib_Tool 0045 { 0046 public: 0047 0048 DEFINE_STANDARD_ALLOC 0049 0050 //! Extracts the parameter of a 3D point lying on a 3D curve 0051 //! or at a distance less than the MaxDist value. 0052 Standard_EXPORT static Standard_Boolean Parameter(const Handle(Geom_Curve)& Curve, const gp_Pnt& Point, const Standard_Real MaxDist, Standard_Real& U); 0053 0054 //! Extracts the parameter of a 3D point lying on a surface 0055 //! or at a distance less than the MaxDist value. 0056 Standard_EXPORT static Standard_Boolean Parameters(const Handle(Geom_Surface)& Surface, const gp_Pnt& Point, const Standard_Real MaxDist, Standard_Real& U, Standard_Real& V); 0057 0058 //! Extracts the parameter of a 2D point lying on a 2D curve 0059 //! or at a distance less than the MaxDist value. 0060 Standard_EXPORT static Standard_Boolean Parameter(const Handle(Geom2d_Curve)& Curve, const gp_Pnt2d& Point, const Standard_Real MaxDist, Standard_Real& U); 0061 0062 //! Computes parameter in theCurve (*thePrmOnCurve) where maximal deviation 0063 //! between theCurve and the linear segment joining its points with 0064 //! the parameters theFPar and theLPar is obtained. 0065 //! Returns the (positive) value of deviation. Returns negative value if 0066 //! the deviation cannot be computed. 0067 //! The returned parameter (in case of successful) will always be in 0068 //! the range [theFPar, theLPar]. 0069 //! Iterative method is used for computation. So, theStartParameter is 0070 //! needed to be set. Recommend value of theStartParameter can be found with 0071 //! the overloaded method. 0072 //! Additionally, following values can be returned (optionally): 0073 //! @param thePtOnCurve - the point on curve where maximal deviation is achieved; 0074 //! @param thePrmOnCurve - the parameter of thePtOnCurve; 0075 //! @param theVecCurvLine - the vector along which is computed (this vector is always 0076 //! perpendicular theLine); 0077 //! @param theLine - the linear segment joining the point of theCurve having parameters 0078 //! theFPar and theLPar. 0079 Standard_EXPORT static 0080 Standard_Real ComputeDeviation(const Geom2dAdaptor_Curve& theCurve, 0081 const Standard_Real theFPar, 0082 const Standard_Real theLPar, 0083 const Standard_Real theStartParameter, 0084 const Standard_Integer theNbIters = 100, 0085 Standard_Real* const thePrmOnCurve = NULL, 0086 gp_Pnt2d* const thePtOnCurve = NULL, 0087 gp_Vec2d* const theVecCurvLine = NULL, 0088 gp_Lin2d* const theLine = NULL); 0089 0090 //! Computes parameter in theCurve (*thePrmOnCurve) where maximal deviation 0091 //! between theCurve and the linear segment joining its points with 0092 //! the parameters theFPar and theLPar is obtained. 0093 //! Returns the (positive) value of deviation. Returns negative value if 0094 //! the deviation cannot be computed. 0095 //! The returned parameter (in case of successful) will always be in 0096 //! the range [theFPar, theLPar]. 0097 //! theNbSubIntervals defines discretization of the given interval [theFPar, theLPar] 0098 //! to provide better search condition. This value should be chosen taking into 0099 //! account complexity of the curve in considered interval. E.g. if there are many 0100 //! oscillations of the curve in the interval then theNbSubIntervals mus be 0101 //! great number. However, the greater value of theNbSubIntervals the slower the 0102 //! algorithm will compute. 0103 //! theNbIters sets number of iterations. 0104 //! ATTENTION!!! 0105 //! This algorithm cannot compute deviation precisely (so, there is no point in 0106 //! setting big value of theNbIters). But it can give some start point for 0107 //! the overloaded method. 0108 Standard_EXPORT static 0109 Standard_Real ComputeDeviation(const Geom2dAdaptor_Curve& theCurve, 0110 const Standard_Real theFPar, 0111 const Standard_Real theLPar, 0112 const Standard_Integer theNbSubIntervals, 0113 const Standard_Integer theNbIters = 10, 0114 Standard_Real * const thePrmOnCurve = NULL); 0115 0116 }; 0117 0118 #endif // _GeomLib_Tool_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |