Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:15:38

0001 // Created on: 1996-03-12
0002 // Created by: Bruno DUMORTIER
0003 // Copyright (c) 1996-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 _GeomConvert_BSplineCurveToBezierCurve_HeaderFile
0018 #define _GeomConvert_BSplineCurveToBezierCurve_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <Geom_BezierCurve.hxx>
0026 #include <NCollection_Array1.hxx>
0027 class Geom_BSplineCurve;
0028 class Geom_BezierCurve;
0029 
0030 //! An algorithm to convert a BSpline curve into a series
0031 //! of adjacent Bezier curves.
0032 //! A BSplineCurveToBezierCurve object provides a framework for:
0033 //! -   defining the BSpline curve to be converted
0034 //! -   implementing the construction algorithm, and
0035 //! -   consulting the results.
0036 //! References :
0037 //! Generating the Bezier points of B-spline curves and surfaces
0038 //! (Wolfgang Bohm) CAD volume 13 number 6 november 1981
0039 class GeomConvert_BSplineCurveToBezierCurve
0040 {
0041 public:
0042   DEFINE_STANDARD_ALLOC
0043 
0044   //! Computes all the data needed to convert the
0045   //! BSpline curve BasisCurve into a series of adjacent Bezier arcs.
0046   Standard_EXPORT GeomConvert_BSplineCurveToBezierCurve(
0047     const occ::handle<Geom_BSplineCurve>& BasisCurve);
0048 
0049   //! Computes all the data needed to convert
0050   //! the portion of the BSpline curve BasisCurve
0051   //! limited by the two parameter values U1 and U2 into a series of adjacent Bezier arcs.
0052   //! The result consists of a series of BasisCurve arcs
0053   //! limited by points corresponding to knot values of the curve.
0054   //! Use the available interrogation functions to ascertain
0055   //! the number of computed Bezier arcs, and then to
0056   //! construct each individual Bezier curve (or all Bezier curves).
0057   //! Note: ParametricTolerance is not used.
0058   //! Raises DomainError if U1 or U2 are out of the parametric bounds of the basis
0059   //! curve [FirstParameter, LastParameter]. The Tolerance criterion
0060   //! is ParametricTolerance.
0061   //! Raised if Abs (U2 - U1) <= ParametricTolerance.
0062   Standard_EXPORT GeomConvert_BSplineCurveToBezierCurve(
0063     const occ::handle<Geom_BSplineCurve>& BasisCurve,
0064     const double                          U1,
0065     const double                          U2,
0066     const double                          ParametricTolerance);
0067 
0068   //! Constructs and returns the Bezier curve of index
0069   //! Index to the table of adjacent Bezier arcs
0070   //! computed by this algorithm.
0071   //! This Bezier curve has the same orientation as the
0072   //! BSpline curve analyzed in this framework.
0073   //! Exceptions
0074   //! Standard_OutOfRange if Index is less than 1 or
0075   //! greater than the number of adjacent Bezier arcs
0076   //! computed by this algorithm.
0077   Standard_EXPORT occ::handle<Geom_BezierCurve> Arc(const int Index);
0078 
0079   //! Constructs all the Bezier curves whose data is
0080   //! computed by this algorithm and loads these curves into the Curves table.
0081   //! The Bezier curves have the same orientation as the
0082   //! BSpline curve analyzed in this framework.
0083   //! Exceptions
0084   //! Standard_DimensionError if the Curves array was
0085   //! not created with the following bounds:
0086   //! -   1 , and
0087   //! -   the number of adjacent Bezier arcs computed by
0088   //! this algorithm (as given by the function NbArcs).
0089   Standard_EXPORT void Arcs(NCollection_Array1<occ::handle<Geom_BezierCurve>>& Curves);
0090 
0091   //! This methode returns the bspline's knots associated to
0092   //! the converted arcs
0093   //! Raised if the length of Curves is not equal to
0094   //! NbArcs + 1
0095   Standard_EXPORT void Knots(NCollection_Array1<double>& TKnots) const;
0096 
0097   //! Returns the number of BezierCurve arcs.
0098   //! If at the creation time you have decomposed the basis curve
0099   //! between the parametric values UFirst, ULast the number of
0100   //! BezierCurve arcs depends on the number of knots included inside
0101   //! the interval [UFirst, ULast].
0102   //! If you have decomposed the whole basis B-spline curve the number
0103   //! of BezierCurve arcs NbArcs is equal to the number of knots less
0104   //! one.
0105   Standard_EXPORT int NbArcs() const;
0106 
0107 private:
0108   occ::handle<Geom_BSplineCurve> myCurve;
0109 };
0110 
0111 #endif // _GeomConvert_BSplineCurveToBezierCurve_HeaderFile