Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:21:11

0001 // Created on: 1993-09-20
0002 // Created by: Modelistation
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 _AppParCurves_MultiBSpCurve_HeaderFile
0018 #define _AppParCurves_MultiBSpCurve_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <NCollection_Array1.hxx>
0025 #include <NCollection_HArray1.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <AppParCurves_MultiCurve.hxx>
0028 #include <AppParCurves_MultiPoint.hxx>
0029 #include <Standard_OStream.hxx>
0030 class gp_Pnt;
0031 class gp_Pnt2d;
0032 class gp_Vec;
0033 class gp_Vec2d;
0034 
0035 //! This class describes a MultiBSpCurve approximating a Multiline.
0036 //! Just as a Multiline is a set of a given number of lines, a MultiBSpCurve is a set
0037 //! of a specified number of bsplines defined by:
0038 //! -   A specified number of MultiPoints - the poles of a specified number of curves
0039 //! -   The degree of approximation identical for each of the specified number of curves.
0040 //!
0041 //! Example of a MultiBSpCurve composed of a specified number of MultiPoints:
0042 //!
0043 //! P1______P2_____P3______P4________........_____PNbMPoints
0044 //!
0045 //! Q1______Q2_____Q3______Q4________........_____QNbMPoints
0046 //! .                                               .
0047 //! .                                               .
0048 //! .                                               .
0049 //! R1______R2_____R3______R4________........_____RNbMPoints
0050 //!
0051 //! Pi, Qi, ..., Ri are points of dimension 2 or 3.
0052 //!
0053 //! (Pi, Qi, ...Ri), i= 1,...NbPoles are MultiPoints.
0054 //! each MultiPoint has got NbPol Poles.
0055 //! MultiBSpCurves are created by the SplineValue method in the ComputeLine
0056 //! class, and by the Value method in TheVariational class. MultiBSpCurve
0057 //! provides the information required to create the BSpline defined by the approximation.
0058 class AppParCurves_MultiBSpCurve : public AppParCurves_MultiCurve
0059 {
0060 public:
0061   DEFINE_STANDARD_ALLOC
0062 
0063   //! returns an indefinite MultiBSpCurve.
0064   Standard_EXPORT AppParCurves_MultiBSpCurve();
0065 
0066   //! creates a MultiBSpCurve, describing BSpline curves all
0067   //! containing the same number of MultiPoint.
0068   //! An exception is raised if Degree < 0.
0069   Standard_EXPORT AppParCurves_MultiBSpCurve(const int NbPol);
0070 
0071   //! creates a MultiBSpCurve, describing BSpline curves all
0072   //! containing the same number of MultiPoint.
0073   //! Each MultiPoint must have NbCurves Poles.
0074   Standard_EXPORT AppParCurves_MultiBSpCurve(
0075     const NCollection_Array1<AppParCurves_MultiPoint>& tabMU,
0076     const NCollection_Array1<double>&                  Knots,
0077     const NCollection_Array1<int>&                     Mults);
0078 
0079   //! creates a MultiBSpCurve, describing BSpline
0080   //! curves, taking control points from <SC>.
0081   Standard_EXPORT AppParCurves_MultiBSpCurve(const AppParCurves_MultiCurve&    SC,
0082                                              const NCollection_Array1<double>& Knots,
0083                                              const NCollection_Array1<int>&    Mults);
0084 
0085   //! Knots of the multiBSpCurve are assigned to <theknots>.
0086   Standard_EXPORT void SetKnots(const NCollection_Array1<double>& theKnots);
0087 
0088   //! Multiplicities of the multiBSpCurve are assigned
0089   //! to <theMults>.
0090   Standard_EXPORT void SetMultiplicities(const NCollection_Array1<int>& theMults);
0091 
0092   //! Returns an array of Reals containing
0093   //! the multiplicities of curves resulting from the approximation.
0094   Standard_EXPORT const NCollection_Array1<double>& Knots() const;
0095 
0096   //! Returns an array of Reals containing the
0097   //! multiplicities of curves resulting from the approximation.
0098   Standard_EXPORT const NCollection_Array1<int>& Multiplicities() const;
0099 
0100   //! returns the degree of the curve(s).
0101   Standard_EXPORT int Degree() const override;
0102 
0103   //! returns the value of the point with a parameter U
0104   //! on the BSpline curve number CuIndex.
0105   //! An exception is raised if CuIndex <0 or > NbCurves.
0106   //! An exception is raised if the curve dimension is 2d.
0107   Standard_EXPORT void Value(const int CuIndex, const double U, gp_Pnt& Pt) const override;
0108 
0109   //! returns the value of the point with a parameter U
0110   //! on the BSpline curve number CuIndex.
0111   //! An exception is raised if CuIndex <0 or > NbCurves.
0112   //! An exception is raised if the curve dimension is 3d.
0113   Standard_EXPORT void Value(const int CuIndex, const double U, gp_Pnt2d& Pt) const override;
0114 
0115   //! returns the value of the point with a parameter U
0116   //! on the BSpline curve number CuIndex.
0117   //! An exception is raised if CuIndex <0 or > NbCurves.
0118   //! An exception is raised if the curve dimension is 3d.
0119   Standard_EXPORT void D1(const int CuIndex, const double U, gp_Pnt& Pt, gp_Vec& V1) const override;
0120 
0121   //! returns the value of the point with a parameter U
0122   //! on the BSpline curve number CuIndex.
0123   //! An exception is raised if CuIndex <0 or > NbCurves.
0124   //! An exception is raised if the curve dimension is 2d.
0125   Standard_EXPORT void D1(const int    CuIndex,
0126                           const double U,
0127                           gp_Pnt2d&    Pt,
0128                           gp_Vec2d&    V1) const override;
0129 
0130   //! returns the value of the point with a parameter U
0131   //! on the BSpline curve number CuIndex.
0132   //! An exception is raised if CuIndex <0 or > NbCurves.
0133   //! An exception is raised if the curve dimension is 3d.
0134   Standard_EXPORT void D2(const int    CuIndex,
0135                           const double U,
0136                           gp_Pnt&      Pt,
0137                           gp_Vec&      V1,
0138                           gp_Vec&      V2) const override;
0139 
0140   //! returns the value of the point with a parameter U
0141   //! on the BSpline curve number CuIndex.
0142   //! An exception is raised if CuIndex <0 or > NbCurves.
0143   //! An exception is raised if the curve dimension is 2d.
0144   Standard_EXPORT void D2(const int    CuIndex,
0145                           const double U,
0146                           gp_Pnt2d&    Pt,
0147                           gp_Vec2d&    V1,
0148                           gp_Vec2d&    V2) const override;
0149 
0150   //! Prints on the stream o information on the current
0151   //! state of the object.
0152   //! Is used to redefine the operator <<.
0153   Standard_EXPORT void Dump(Standard_OStream& o) const override;
0154 
0155 private:
0156   occ::handle<NCollection_HArray1<double>> myknots;
0157   occ::handle<NCollection_HArray1<int>>    mymults;
0158   int                                      myDegree;
0159 };
0160 
0161 #endif // _AppParCurves_MultiBSpCurve_HeaderFile