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_BuilderApproxCurve_HeaderFile
0015 #define _HelixGeom_BuilderApproxCurve_HeaderFile
0016 
0017 #include <Standard.hxx>
0018 #include <Standard_DefineAlloc.hxx>
0019 #include <Standard_Handle.hxx>
0020 
0021 #include <Standard_Integer.hxx>
0022 #include <Standard_Real.hxx>
0023 #include <GeomAbs_Shape.hxx>
0024 #include <Geom_Curve.hxx>
0025 #include <NCollection_Sequence.hxx>
0026 
0027 //! Base class for helix curve approximation algorithms.
0028 //!
0029 //! This abstract class provides common functionality for approximating
0030 //! parametric helix curves using B-spline curves. It manages:
0031 //! - Approximation tolerance and parameters
0032 //! - Continuity requirements (C0, C1, C2)
0033 //! - Maximum degree and number of segments
0034 //! - Error and warning status reporting
0035 //! - Result curve storage
0036 //!
0037 //! Derived classes must implement the Perform() method to execute
0038 //! the specific approximation algorithm.
0039 //!
0040 //! @sa HelixGeom_BuilderHelixGen, HelixGeom_BuilderHelix, HelixGeom_BuilderHelixCoil
0041 class HelixGeom_BuilderApproxCurve
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   //! Sets approximation parameters
0047   Standard_EXPORT void SetApproxParameters(const GeomAbs_Shape aCont,
0048                                            const int           aMaxDegree,
0049                                            const int           aMaxSeg);
0050 
0051   //! Gets approximation parameters
0052   Standard_EXPORT void ApproxParameters(GeomAbs_Shape& aCont, int& aMaxDegree, int& aMaxSeg) const;
0053 
0054   //! Sets approximation tolerance
0055   Standard_EXPORT void SetTolerance(const double aTolerance);
0056 
0057   //! Gets approximation tolerance
0058   Standard_EXPORT double Tolerance() const;
0059 
0060   //! Gets actual tolerance reached by approximation algorithm
0061   Standard_EXPORT double ToleranceReached() const;
0062 
0063   //! Gets sequence of BSpline curves representing helix coils
0064   Standard_EXPORT const NCollection_Sequence<occ::handle<Geom_Curve>>& Curves() const;
0065 
0066   //! Returns error status of algorithm
0067   Standard_EXPORT int ErrorStatus() const;
0068 
0069   //! Returns warning status of algorithm
0070   Standard_EXPORT int WarningStatus() const;
0071 
0072   //! Performs calculations.
0073   //! Must be redefined.
0074   Standard_EXPORT virtual void Perform() = 0;
0075 
0076 protected:
0077   //! Sets default values of approximation parameters
0078   Standard_EXPORT HelixGeom_BuilderApproxCurve();
0079   Standard_EXPORT virtual ~HelixGeom_BuilderApproxCurve();
0080 
0081   int                                           myErrorStatus;
0082   int                                           myWarningStatus;
0083   double                                        myTolerance;
0084   GeomAbs_Shape                                 myCont;
0085   int                                           myMaxDegree;
0086   int                                           myMaxSeg;
0087   double                                        myTolReached;
0088   NCollection_Sequence<occ::handle<Geom_Curve>> myCurves;
0089 };
0090 
0091 #endif // _HelixGeom_BuilderApproxCurve_HeaderFile