Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/Convert_ConicToBSplineCurve.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 1991-10-10
0002 // Created by: Jean Claude VAUTHIER
0003 // Copyright (c) 1991-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 _Convert_ConicToBSplineCurve_HeaderFile
0018 #define _Convert_ConicToBSplineCurve_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 #include <Standard_Macro.hxx>
0024 
0025 #include <Convert_ParameterisationType.hxx>
0026 #include <gp_Pnt2d.hxx>
0027 #include <NCollection_Array1.hxx>
0028 #include <NCollection_HArray1.hxx>
0029 
0030 //! Root class for algorithms which convert a conic curve into
0031 //! a BSpline curve (CircleToBSplineCurve, EllipseToBSplineCurve,
0032 //! HyperbolaToBSplineCurve, ParabolaToBSplineCurve).
0033 //! These algorithms all work on 2D curves from the gp
0034 //! package and compute all the data needed to construct a
0035 //! BSpline curve equivalent to the conic curve. This data consists of:
0036 //! -   the degree of the curve,
0037 //! -   the periodic characteristics of the curve,
0038 //! -   a poles table with associated weights,
0039 //! -   a knots table with associated multiplicities.
0040 //! The abstract class ConicToBSplineCurve provides a
0041 //! framework for storing and consulting this computed data.
0042 class Convert_ConicToBSplineCurve
0043 {
0044 public:
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! Returns the degree of the BSpline curve whose data is
0048   //! computed in this framework.
0049   [[nodiscard]] Standard_EXPORT int Degree() const;
0050 
0051   //! Returns the number of poles of the BSpline curve whose
0052   //! data is computed in this framework.
0053   [[nodiscard]] Standard_EXPORT int NbPoles() const;
0054 
0055   //! Returns the number of knots of the BSpline curve whose
0056   //! data is computed in this framework.
0057   [[nodiscard]] Standard_EXPORT int NbKnots() const;
0058 
0059   //! Returns true if the BSpline curve whose data is computed in
0060   //! this framework is periodic.
0061   [[nodiscard]] Standard_EXPORT bool IsPeriodic() const;
0062 
0063   //! Returns the pole of index Index to the poles table of the
0064   //! BSpline curve whose data is computed in this framework.
0065   //! @param[in] theIndex pole index (1-based)
0066   //! @return pole at the given index
0067   //! @throws Standard_OutOfRange if theIndex is out of bounds
0068   Standard_DEPRECATED("Use Poles() batch accessor instead")
0069   Standard_EXPORT gp_Pnt2d Pole(const int theIndex) const;
0070 
0071   //! Returns the weight of the pole of index Index to the poles
0072   //! table of the BSpline curve whose data is computed in this framework.
0073   //! @param[in] theIndex weight index (1-based)
0074   //! @return weight at the given index
0075   //! @throws Standard_OutOfRange if theIndex is out of bounds
0076   Standard_DEPRECATED("Use Weights() batch accessor instead")
0077   Standard_EXPORT double Weight(const int theIndex) const;
0078 
0079   //! Returns the knot of index Index to the knots table of the
0080   //! BSpline curve whose data is computed in this framework.
0081   //! @param[in] theIndex knot index (1-based)
0082   //! @return knot at the given index
0083   //! @throws Standard_OutOfRange if theIndex is out of bounds
0084   Standard_DEPRECATED("Use Knots() batch accessor instead")
0085   Standard_EXPORT double Knot(const int theIndex) const;
0086 
0087   //! Returns the multiplicity of the knot of index Index to the
0088   //! knots table of the BSpline curve whose data is computed in this framework.
0089   //! @param[in] theIndex multiplicity index (1-based)
0090   //! @return multiplicity at the given index
0091   //! @throws Standard_OutOfRange if theIndex is out of bounds
0092   Standard_DEPRECATED("Use Multiplicities() batch accessor instead")
0093   Standard_EXPORT int Multiplicity(const int theIndex) const;
0094 
0095   //! Returns the poles of the BSpline curve.
0096   [[nodiscard]] Standard_EXPORT const NCollection_Array1<gp_Pnt2d>& Poles() const;
0097 
0098   //! Returns the weights of the BSpline curve.
0099   [[nodiscard]] Standard_EXPORT const NCollection_Array1<double>& Weights() const;
0100 
0101   //! Returns the knots of the BSpline curve.
0102   [[nodiscard]] Standard_EXPORT const NCollection_Array1<double>& Knots() const;
0103 
0104   //! Returns the multiplicities of the BSpline curve.
0105   [[nodiscard]] Standard_EXPORT const NCollection_Array1<int>& Multiplicities() const;
0106 
0107   //! Legacy API returning handle arrays for compatibility.
0108   Standard_DEPRECATED("Use array-based BuildCosAndSin() overload instead")
0109   Standard_EXPORT void BuildCosAndSin(const Convert_ParameterisationType        theParametrisation,
0110                                       occ::handle<NCollection_HArray1<double>>& theCosNumerator,
0111                                       occ::handle<NCollection_HArray1<double>>& theSinNumerator,
0112                                       occ::handle<NCollection_HArray1<double>>& theDenominator,
0113                                       int&                                      theDegree,
0114                                       occ::handle<NCollection_HArray1<double>>& theKnots,
0115                                       occ::handle<NCollection_HArray1<int>>&    theMults) const;
0116 
0117   //! Legacy API returning handle arrays for compatibility.
0118   Standard_DEPRECATED("Use array-based BuildCosAndSin() overload instead")
0119   Standard_EXPORT void BuildCosAndSin(const Convert_ParameterisationType        theParametrisation,
0120                                       const double                              theUFirst,
0121                                       const double                              theULast,
0122                                       occ::handle<NCollection_HArray1<double>>& theCosNumerator,
0123                                       occ::handle<NCollection_HArray1<double>>& theSinNumerator,
0124                                       occ::handle<NCollection_HArray1<double>>& theDenominator,
0125                                       int&                                      theDegree,
0126                                       occ::handle<NCollection_HArray1<double>>& theKnots,
0127                                       occ::handle<NCollection_HArray1<int>>&    theMults) const;
0128 
0129 protected:
0130   Standard_EXPORT Convert_ConicToBSplineCurve(const int theNumberOfPoles,
0131                                               const int theNumberOfKnots,
0132                                               const int theDegree);
0133 
0134   Standard_EXPORT void BuildCosAndSin(const Convert_ParameterisationType theParametrisation,
0135                                       NCollection_Array1<double>&        theCosNumerator,
0136                                       NCollection_Array1<double>&        theSinNumerator,
0137                                       NCollection_Array1<double>&        theDenominator,
0138                                       int&                               theDegree,
0139                                       NCollection_Array1<double>&        theKnots,
0140                                       NCollection_Array1<int>&           theMults) const;
0141 
0142   Standard_EXPORT void BuildCosAndSin(const Convert_ParameterisationType theParametrisation,
0143                                       const double                       theUFirst,
0144                                       const double                       theULast,
0145                                       NCollection_Array1<double>&        theCosNumerator,
0146                                       NCollection_Array1<double>&        theSinNumerator,
0147                                       NCollection_Array1<double>&        theDenominator,
0148                                       int&                               theDegree,
0149                                       NCollection_Array1<double>&        theKnots,
0150                                       NCollection_Array1<int>&           theMults) const;
0151 
0152 protected:
0153   NCollection_Array1<gp_Pnt2d> myPoles;
0154   NCollection_Array1<double>   myWeights;
0155   NCollection_Array1<double>   myKnots;
0156   NCollection_Array1<int>      myMults;
0157   int                          myDegree     = 0;
0158   bool                         myIsPeriodic = false;
0159 };
0160 
0161 #endif // _Convert_ConicToBSplineCurve_HeaderFile