Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:14:53

0001 // Created on: 1993-01-09
0002 // Created by: Kiran
0003 // Copyright (c) 1993-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 _IGESGeom_BSplineCurve_HeaderFile
0018 #define _IGESGeom_BSplineCurve_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <Standard_Integer.hxx>
0024 #include <NCollection_Array1.hxx>
0025 #include <NCollection_HArray1.hxx>
0026 #include <gp_XYZ.hxx>
0027 #include <IGESData_IGESEntity.hxx>
0028 class gp_Pnt;
0029 
0030 //! defines IGESBSplineCurve, Type <126> Form <0-5>
0031 //! in package IGESGeom
0032 //! A parametric equation obtained by dividing two summations
0033 //! involving weights (which are real numbers), the control
0034 //! points, and B-Spline basis functions
0035 class IGESGeom_BSplineCurve : public IGESData_IGESEntity
0036 {
0037 
0038 public:
0039   Standard_EXPORT IGESGeom_BSplineCurve();
0040 
0041   //! This method is used to set the fields of the class
0042   //! BSplineCurve. Beware about indexation of arrays
0043   //! - anIndex      : Upper index of the sum
0044   //! - aDegree      : Degree of basis functions
0045   //! - aPlanar      : 0 = nonplanar curve, 1 = planar curve
0046   //! - aClosed      : 0 = open curve, 1 = closed curve
0047   //! - aPolynom     : 0 = rational, 1 = polynomial
0048   //! - aPeriodic    : 0 = nonperiodic, 1 = periodic
0049   //! - allKnots     : Knot sequence values [-Degree,Index+1]
0050   //! - allWeights   : Array of weights     [0,Index]
0051   //! - allPoles     : X, Y, Z coordinates of all control points
0052   //! [0,Index]
0053   //! - aUmin, aUmax : Starting and ending parameter values
0054   //! - aNorm        : Unit normal (if the curve is planar)
0055   //! raises exception if allWeights & allPoles are not of same size.
0056   Standard_EXPORT void Init(const int                                       anIndex,
0057                             const int                                       aDegree,
0058                             const bool                                      aPlanar,
0059                             const bool                                      aClosed,
0060                             const bool                                      aPolynom,
0061                             const bool                                      aPeriodic,
0062                             const occ::handle<NCollection_HArray1<double>>& allKnots,
0063                             const occ::handle<NCollection_HArray1<double>>& allWeights,
0064                             const occ::handle<NCollection_HArray1<gp_XYZ>>& allPoles,
0065                             const double                                    aUmin,
0066                             const double                                    aUmax,
0067                             const gp_XYZ&                                   aNorm);
0068 
0069   //! Changes FormNumber (indicates the Shape of the Curve)
0070   //! Error if not in range [0-5]
0071   Standard_EXPORT void SetFormNumber(const int form);
0072 
0073   //! returns the upper index of the sum (see Knots,Poles)
0074   Standard_EXPORT int UpperIndex() const;
0075 
0076   //! returns the degree of basis functions
0077   Standard_EXPORT int Degree() const;
0078 
0079   //! returns True if the curve is Planar, False if non-planar
0080   Standard_EXPORT bool IsPlanar() const;
0081 
0082   //! returns True if the curve is closed, False if open
0083   Standard_EXPORT bool IsClosed() const;
0084 
0085   //! returns True if the curve is polynomial, False if rational
0086   //! <flag> False (D) : computed from the list of weights
0087   //! (all must be equal)
0088   //! <flag> True : as recorded
0089   Standard_EXPORT bool IsPolynomial(const bool flag = false) const;
0090 
0091   //! returns True if the curve is periodic, False otherwise
0092   Standard_EXPORT bool IsPeriodic() const;
0093 
0094   //! returns the number of knots (i.e. Degree + UpperIndex + 2)
0095   Standard_EXPORT int NbKnots() const;
0096 
0097   //! returns the knot referred to by anIndex,
0098   //! inside the range [-Degree,UpperIndex+1]
0099   //! raises exception if
0100   //! anIndex < -Degree() or anIndex > (NbKnots() - Degree())
0101   //! Note : Knots are numbered from -Degree (not from 1)
0102   Standard_EXPORT double Knot(const int anIndex) const;
0103 
0104   //! returns number of poles (i.e. UpperIndex + 1)
0105   Standard_EXPORT int NbPoles() const;
0106 
0107   //! returns the weight referred to by anIndex, in [0,UpperIndex]
0108   //! raises exception if anIndex < 0 or anIndex > UpperIndex()
0109   Standard_EXPORT double Weight(const int anIndex) const;
0110 
0111   //! returns the pole referred to by anIndex, in [0,UpperIndex]
0112   //! raises exception if anIndex < 0 or anIndex > UpperIndex()
0113   Standard_EXPORT gp_Pnt Pole(const int anIndex) const;
0114 
0115   //! returns the anIndex'th pole after applying Transf. Matrix
0116   //! raises exception if an Index < 0 or an Index > UpperIndex()
0117   Standard_EXPORT gp_Pnt TransformedPole(const int anIndex) const;
0118 
0119   //! returns starting parameter value
0120   Standard_EXPORT double UMin() const;
0121 
0122   //! returns ending parameter value
0123   Standard_EXPORT double UMax() const;
0124 
0125   //! if the curve is nonplanar then (0, 0, 0) is returned
0126   Standard_EXPORT gp_XYZ Normal() const;
0127 
0128   DEFINE_STANDARD_RTTIEXT(IGESGeom_BSplineCurve, IGESData_IGESEntity)
0129 
0130 private:
0131   int                                      theIndex;
0132   int                                      theDegree;
0133   bool                                     isPlanar;
0134   bool                                     isClosed;
0135   bool                                     isPolynomial;
0136   bool                                     isPeriodic;
0137   occ::handle<NCollection_HArray1<double>> theKnots;
0138   occ::handle<NCollection_HArray1<double>> theWeights;
0139   occ::handle<NCollection_HArray1<gp_XYZ>> thePoles;
0140   double                                   theUmin;
0141   double                                   theUmax;
0142   gp_XYZ                                   theNorm;
0143 };
0144 
0145 #endif // _IGESGeom_BSplineCurve_HeaderFile