Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-28 09:20:23

0001 // Copyright (c) 2025 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _HelixGeom_Tools_HeaderFile
0015 #define _HelixGeom_Tools_HeaderFile
0016 
0017 #include <Adaptor3d_Curve.hxx>
0018 #include <GeomAbs_Shape.hxx>
0019 
0020 class Geom_BSplineCurve;
0021 
0022 //! Static utility class providing approximation algorithms for helix curves.
0023 //!
0024 //! This class contains static methods for:
0025 //! - Converting analytical helix curves to B-spline approximations
0026 //! - Generic curve approximation with specified tolerances and continuity
0027 //! - High-quality approximation suitable for CAD/CAM applications
0028 //!
0029 //! The approximation algorithms use advanced techniques to ensure:
0030 //! - Accurate representation within specified tolerances
0031 //! - Smooth continuity (C0, C1, C2) as required
0032 //! - Efficient B-spline parameterization
0033 //! - Robust handling of edge cases
0034 class HelixGeom_Tools
0035 {
0036 public:
0037   DEFINE_STANDARD_ALLOC
0038 
0039   //! Approximates a parametric helix curve using B-spline representation.
0040   //! @param aT1 [in] Start parameter (angular position in radians)
0041   //! @param aT2 [in] End parameter (angular position in radians)
0042   //! @param aPitch [in] Helix pitch (vertical distance per 2*PI radians)
0043   //! @param aRStart [in] Starting radius at parameter aT1
0044   //! @param aTaperAngle [in] Taper angle in radians (0 = cylindrical helix)
0045   //! @param aIsCW [in] True for clockwise, false for counter-clockwise
0046   //! @param aTol [in] Approximation tolerance
0047   //! @param theBSpl [out] Resulting B-spline curve
0048   //! @param theMaxError [out] Maximum approximation error achieved
0049   //! @return 0 on success, error code otherwise
0050   Standard_EXPORT static int ApprHelix(const double                    aT1,
0051                                        const double                    aT2,
0052                                        const double                    aPitch,
0053                                        const double                    aRStart,
0054                                        const double                    aTaperAngle,
0055                                        const bool                      aIsCW,
0056                                        const double                    aTol,
0057                                        occ::handle<Geom_BSplineCurve>& theBSpl,
0058                                        double&                         theMaxError);
0059 
0060   //! Approximates a generic 3D curve using B-spline representation.
0061   //! @param theHC [in] Handle to the curve adaptor to approximate
0062   //! @param theTol [in] Approximation tolerance
0063   //! @param theCont [in] Required continuity (C0, C1, C2)
0064   //! @param theMaxSeg [in] Maximum number of curve segments
0065   //! @param theMaxDeg [in] Maximum degree of B-spline curve
0066   //! @param theBSpl [out] Resulting B-spline curve
0067   //! @param theMaxError [out] Maximum approximation error achieved
0068   //! @return 0 on success, error code otherwise
0069   Standard_EXPORT static int ApprCurve3D(const occ::handle<Adaptor3d_Curve>& theHC,
0070                                          const double                        theTol,
0071                                          const GeomAbs_Shape                 theCont,
0072                                          const int                           theMaxSeg,
0073                                          const int                           theMaxDeg,
0074                                          occ::handle<Geom_BSplineCurve>&     theBSpl,
0075                                          double&                             theMaxError);
0076 };
0077 
0078 #endif // _HelixGeom_Tools_HeaderFile