|
||||
File indexing completed on 2025-01-18 10:04:54
0001 // Created on: 1998-06-03 0002 // Created by: data exchange team 0003 // Copyright (c) 1998-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 _ShapeAnalysis_Curve_HeaderFile 0018 #define _ShapeAnalysis_Curve_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <Standard_Integer.hxx> 0025 #include <TColgp_Array1OfPnt.hxx> 0026 #include <TColgp_SequenceOfPnt2d.hxx> 0027 #include <TColgp_SequenceOfPnt.hxx> 0028 class Geom_Curve; 0029 class gp_Pnt; 0030 class Adaptor3d_Curve; 0031 class Geom2d_Curve; 0032 class Bnd_Box2d; 0033 class gp_XYZ; 0034 0035 0036 //! Analyzing tool for 2d or 3d curve. 0037 //! Computes parameters of projected point onto a curve. 0038 class ShapeAnalysis_Curve 0039 { 0040 public: 0041 0042 DEFINE_STANDARD_ALLOC 0043 0044 0045 //! Projects a Point on a Curve. 0046 //! Computes the projected point and its parameter on the curve. 0047 //! <preci> is used as 3d precision (hence, 0 will produce 0048 //! reject unless exact confusion). 0049 //! The number of iterations is limited. 0050 //! If AdjustToEnds is True, point will be adjusted to the end 0051 //! of the curve if distance is less than <preci> 0052 //! 0053 //! Returned value is the distance between the given point and 0054 //! computed one. 0055 Standard_EXPORT Standard_Real Project (const Handle(Geom_Curve)& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Boolean AdjustToEnds = Standard_True) const; 0056 0057 //! Projects a Point on a Curve. 0058 //! Computes the projected point and its parameter on the curve. 0059 //! <preci> is used as 3d precision (hence, 0 will produce 0060 //! reject unless exact confusion). 0061 //! The number of iterations is limited. 0062 //! 0063 //! Returned value is the distance between the given point and 0064 //! computed one. 0065 Standard_EXPORT Standard_Real Project (const Adaptor3d_Curve& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Boolean AdjustToEnds = Standard_True) const; 0066 0067 //! Projects a Point on a Curve, but parameters are limited 0068 //! between <cf> and <cl>. 0069 //! The range [cf, cl] is extended with help of Adaptor3d on the 0070 //! basis of 3d precision <preci>. 0071 //! If AdjustToEnds is True, point will be adjusted to the end 0072 //! of the curve if distance is less than <preci> 0073 Standard_EXPORT Standard_Real Project (const Handle(Geom_Curve)& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Real cf, const Standard_Real cl, const Standard_Boolean AdjustToEnds = Standard_True) const; 0074 0075 Standard_EXPORT Standard_Real ProjectAct (const Adaptor3d_Curve& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param) const; 0076 0077 //! Projects a Point on a Curve using Newton method. 0078 //! <paramPrev> is taken as the first approximation of solution. 0079 //! If Newton algorithm fails the method Project() is used. 0080 //! If AdjustToEnds is True, point will be adjusted to the end 0081 //! of the curve if distance is less than <preci> 0082 Standard_EXPORT Standard_Real NextProject (const Standard_Real paramPrev, const Handle(Geom_Curve)& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param, const Standard_Real cf, const Standard_Real cl, const Standard_Boolean AdjustToEnds = Standard_True) const; 0083 0084 //! Projects a Point on a Curve using Newton method. 0085 //! <paramPrev> is taken as the first approximation of solution. 0086 //! If Newton algorithm fails the method Project() is used. 0087 Standard_EXPORT Standard_Real NextProject (const Standard_Real paramPrev, const Adaptor3d_Curve& C3D, const gp_Pnt& P3D, const Standard_Real preci, gp_Pnt& proj, Standard_Real& param) const; 0088 0089 //! Validate parameters First and Last for the given curve 0090 //! in order to make them valid for creation of edge. 0091 //! This includes: 0092 //! - limiting range [First,Last] by range of curve 0093 //! - adjusting range [First,Last] for periodic (or closed) 0094 //! curve if Last < First 0095 //! Returns True if parameters are OK or are successfully 0096 //! corrected, or False if parameters cannot be corrected. 0097 //! In the latter case, parameters are reset to range of curve. 0098 Standard_EXPORT Standard_Boolean ValidateRange (const Handle(Geom_Curve)& Crv, Standard_Real& First, Standard_Real& Last, const Standard_Real prec) const; 0099 0100 //! Computes a boundary box on segment of curve C2d from First 0101 //! to Last. This is done by taking NPoints points from the 0102 //! curve and, if Exact is True, by searching for exact 0103 //! extrema. All these points are added to Box. 0104 Standard_EXPORT void FillBndBox (const Handle(Geom2d_Curve)& C2d, const Standard_Real First, const Standard_Real Last, const Standard_Integer NPoints, const Standard_Boolean Exact, Bnd_Box2d& Box) const; 0105 0106 //! Defines which pcurve (C1 or C2) should be chosen for FORWARD 0107 //! seam edge. 0108 Standard_EXPORT Standard_Integer SelectForwardSeam (const Handle(Geom2d_Curve)& C1, const Handle(Geom2d_Curve)& C2) const; 0109 0110 //! Checks if points are planar with given preci. If Normal has not zero 0111 //! modulus, checks with given normal 0112 Standard_EXPORT static Standard_Boolean IsPlanar (const TColgp_Array1OfPnt& pnts, gp_XYZ& Normal, const Standard_Real preci = 0); 0113 0114 //! Checks if curve is planar with given preci. If Normal has not zero 0115 //! modulus, checks with given normal 0116 Standard_EXPORT static Standard_Boolean IsPlanar (const Handle(Geom_Curve)& curve, gp_XYZ& Normal, const Standard_Real preci = 0); 0117 0118 //! Returns sample points which will serve as linearisation 0119 //! of the2d curve in range (first, last) 0120 //! The distribution of sample points is consystent with 0121 //! what is used by BRepTopAdaptor_FClass2d 0122 Standard_EXPORT static Standard_Boolean GetSamplePoints (const Handle(Geom2d_Curve)& curve, const Standard_Real first, const Standard_Real last, TColgp_SequenceOfPnt2d& seq); 0123 0124 //! Returns sample points which will serve as linearisation 0125 //! of the curve in range (first, last) 0126 Standard_EXPORT static Standard_Boolean GetSamplePoints (const Handle(Geom_Curve)& curve, const Standard_Real first, const Standard_Real last, TColgp_SequenceOfPnt& seq); 0127 0128 //! Tells if the Curve is closed with given precision. 0129 //! If <preci> < 0 then Precision::Confusion is used. 0130 Standard_EXPORT static Standard_Boolean IsClosed (const Handle(Geom_Curve)& curve, const Standard_Real preci = -1); 0131 0132 //! This method was implemented as fix for changes in trimmed curve 0133 //! behaviour. For the moment trimmed curve returns false anyway. 0134 //! So it is necessary to adapt all Data exchange tools for this behaviour. 0135 //! Current implementation takes into account that curve may be offset. 0136 Standard_EXPORT static Standard_Boolean IsPeriodic (const Handle(Geom_Curve)& curve); 0137 0138 //! The same as for Curve3d. 0139 Standard_EXPORT static Standard_Boolean IsPeriodic (const Handle(Geom2d_Curve)& curve); 0140 0141 0142 0143 0144 protected: 0145 0146 0147 0148 0149 0150 private: 0151 0152 0153 0154 0155 0156 }; 0157 0158 0159 0160 0161 0162 0163 0164 #endif // _ShapeAnalysis_Curve_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |