|
|
|||
File indexing completed on 2026-09-20 09:18: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 <gp_Pnt.hxx> 0026 #include <NCollection_Array1.hxx> 0027 #include <gp_Pnt2d.hxx> 0028 #include <NCollection_Sequence.hxx> 0029 class Geom_Curve; 0030 class gp_Pnt; 0031 class Adaptor3d_Curve; 0032 class Geom2d_Curve; 0033 class Bnd_Box2d; 0034 class gp_XYZ; 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 DEFINE_STANDARD_ALLOC 0042 0043 //! Projects a Point on a Curve. 0044 //! Computes the projected point and its parameter on the curve. 0045 //! <preci> is used as 3d precision (hence, 0 will produce 0046 //! reject unless exact confusion). 0047 //! The number of iterations is limited. 0048 //! If AdjustToEnds is True, point will be adjusted to the end 0049 //! of the curve if distance is less than <preci> 0050 //! 0051 //! Returned value is the distance between the given point and 0052 //! computed one. 0053 Standard_EXPORT double Project(const occ::handle<Geom_Curve>& C3D, 0054 const gp_Pnt& P3D, 0055 const double preci, 0056 gp_Pnt& proj, 0057 double& param, 0058 const bool AdjustToEnds = true) const; 0059 0060 //! Projects a Point on a Curve. 0061 //! Computes the projected point and its parameter on the curve. 0062 //! <preci> is used as 3d precision (hence, 0 will produce 0063 //! reject unless exact confusion). 0064 //! The number of iterations is limited. 0065 //! 0066 //! Returned value is the distance between the given point and 0067 //! computed one. 0068 Standard_EXPORT double Project(const Adaptor3d_Curve& C3D, 0069 const gp_Pnt& P3D, 0070 const double preci, 0071 gp_Pnt& proj, 0072 double& param, 0073 const bool AdjustToEnds = true) const; 0074 0075 //! Projects a Point on a Curve, but parameters are limited 0076 //! between <cf> and <cl>. 0077 //! The range [cf, cl] is extended with help of Adaptor3d on the 0078 //! basis of 3d precision <preci>. 0079 //! If AdjustToEnds is True, point will be adjusted to the end 0080 //! of the curve if distance is less than <preci> 0081 Standard_EXPORT double Project(const occ::handle<Geom_Curve>& C3D, 0082 const gp_Pnt& P3D, 0083 const double preci, 0084 gp_Pnt& proj, 0085 double& param, 0086 const double cf, 0087 const double cl, 0088 const bool AdjustToEnds = true) const; 0089 0090 Standard_EXPORT double ProjectAct(const Adaptor3d_Curve& C3D, 0091 const gp_Pnt& P3D, 0092 const double preci, 0093 gp_Pnt& proj, 0094 double& param) const; 0095 0096 //! Projects a Point on a Curve using Newton method. 0097 //! <paramPrev> is taken as the first approximation of solution. 0098 //! If Newton algorithm fails the method Project() is used. 0099 //! If AdjustToEnds is True, point will be adjusted to the end 0100 //! of the curve if distance is less than <preci> 0101 Standard_EXPORT double NextProject(const double paramPrev, 0102 const occ::handle<Geom_Curve>& C3D, 0103 const gp_Pnt& P3D, 0104 const double preci, 0105 gp_Pnt& proj, 0106 double& param, 0107 const double cf, 0108 const double cl, 0109 const bool AdjustToEnds = true) const; 0110 0111 //! Projects a Point on a Curve using Newton method. 0112 //! <paramPrev> is taken as the first approximation of solution. 0113 //! If Newton algorithm fails the method Project() is used. 0114 Standard_EXPORT double NextProject(const double paramPrev, 0115 const Adaptor3d_Curve& C3D, 0116 const gp_Pnt& P3D, 0117 const double preci, 0118 gp_Pnt& proj, 0119 double& param) const; 0120 0121 //! Validate parameters First and Last for the given curve 0122 //! in order to make them valid for creation of edge. 0123 //! This includes: 0124 //! - limiting range [First,Last] by range of curve 0125 //! - adjusting range [First,Last] for periodic (or closed) 0126 //! curve if Last < First 0127 //! Returns True if parameters are OK or are successfully 0128 //! corrected, or False if parameters cannot be corrected. 0129 //! In the latter case, parameters are reset to range of curve. 0130 Standard_EXPORT bool ValidateRange(const occ::handle<Geom_Curve>& Crv, 0131 double& First, 0132 double& Last, 0133 const double prec) const; 0134 0135 //! Computes a boundary box on segment of curve C2d from First 0136 //! to Last. This is done by taking NPoints points from the 0137 //! curve and, if Exact is True, by searching for exact 0138 //! extrema. All these points are added to Box. 0139 Standard_EXPORT void FillBndBox(const occ::handle<Geom2d_Curve>& C2d, 0140 const double First, 0141 const double Last, 0142 const int NPoints, 0143 const bool Exact, 0144 Bnd_Box2d& Box) const; 0145 0146 //! Defines which pcurve (C1 or C2) should be chosen for FORWARD 0147 //! seam edge. 0148 Standard_EXPORT int SelectForwardSeam(const occ::handle<Geom2d_Curve>& C1, 0149 const occ::handle<Geom2d_Curve>& C2) const; 0150 0151 //! Checks if points are planar with given preci. If Normal has not zero 0152 //! modulus, checks with given normal 0153 Standard_EXPORT static bool IsPlanar(const NCollection_Array1<gp_Pnt>& pnts, 0154 gp_XYZ& Normal, 0155 const double preci = 0); 0156 0157 //! Checks if curve is planar with given preci. If Normal has not zero 0158 //! modulus, checks with given normal 0159 Standard_EXPORT static bool IsPlanar(const occ::handle<Geom_Curve>& curve, 0160 gp_XYZ& Normal, 0161 const double preci = 0); 0162 0163 //! Returns sample points which will serve as linearisation 0164 //! of the2d curve in range (first, last) 0165 //! The distribution of sample points is consystent with 0166 //! what is used by BRepTopAdaptor_FClass2d 0167 Standard_EXPORT static bool GetSamplePoints(const occ::handle<Geom2d_Curve>& curve, 0168 const double first, 0169 const double last, 0170 NCollection_Sequence<gp_Pnt2d>& seq); 0171 0172 //! Returns sample points which will serve as linearisation 0173 //! of the curve in range (first, last) 0174 Standard_EXPORT static bool GetSamplePoints(const occ::handle<Geom_Curve>& curve, 0175 const double first, 0176 const double last, 0177 NCollection_Sequence<gp_Pnt>& seq); 0178 0179 //! Tells if the Curve is closed with given precision. 0180 //! If <preci> < 0 then Precision::Confusion is used. 0181 Standard_EXPORT static bool IsClosed(const occ::handle<Geom_Curve>& curve, 0182 const double preci = -1); 0183 0184 //! This method was implemented as fix for changes in trimmed curve 0185 //! behaviour. For the moment trimmed curve returns false anyway. 0186 //! So it is necessary to adapt all Data exchange tools for this behaviour. 0187 //! Current implementation takes into account that curve may be offset. 0188 Standard_EXPORT static bool IsPeriodic(const occ::handle<Geom_Curve>& curve); 0189 0190 //! The same as for Curve3d. 0191 Standard_EXPORT static bool IsPeriodic(const occ::handle<Geom2d_Curve>& curve); 0192 }; 0193 0194 #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 |
|