Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-08 09:16:08

0001 // Created on: 1993-03-24
0002 // Created by: DUB
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 _Geom2dConvert_BSplineCurveToBezierCurve_HeaderFile
0018 #define _Geom2dConvert_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 <TColGeom2d_Array1OfBezierCurve.hxx>
0026 #include <TColStd_Array1OfReal.hxx>
0027 class Geom2d_BSplineCurve;
0028 class Geom2d_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 Geom2dConvert_BSplineCurveToBezierCurve
0040 {
0041 public:
0042   DEFINE_STANDARD_ALLOC
0043 
0044   //! Computes all the data needed to convert
0045   //! -   the BSpline curve BasisCurve, into a series of adjacent Bezier arcs.
0046   //! The result consists of a series of BasisCurve arcs
0047   //! limited by points corresponding to knot values of the curve.
0048   //! Use the available interrogation functions to ascertain
0049   //! the number of computed Bezier arcs, and then to
0050   //! construct each individual Bezier curve (or all Bezier curves).
0051   //! Note: ParametricTolerance is not used.
0052   Standard_EXPORT Geom2dConvert_BSplineCurveToBezierCurve(
0053     const Handle(Geom2d_BSplineCurve)& BasisCurve);
0054 
0055   //! Computes all the data needed to convert
0056   //! the portion of the BSpline curve BasisCurve
0057   //! limited by the two parameter values U1 and U2
0058   //! for Example if there is a Knot Uk and
0059   //! Uk < U < Uk + ParametricTolerance/2 the last curve
0060   //! corresponds to the span [Uk-1, Uk] and not to  [Uk, Uk+1]
0061   //! The result consists of a series of BasisCurve arcs
0062   //! limited by points corresponding to knot values of the curve.
0063   //! Use the available interrogation functions to ascertain
0064   //! the number of computed Bezier arcs, and then to
0065   //! construct each individual Bezier curve (or all Bezier curves).
0066   //! Note: ParametricTolerance is not used.
0067   //! Raises DomainError if U1 or U2 are out of the parametric bounds of the basis
0068   //! curve [FirstParameter, LastParameter]. The Tolerance criterion
0069   //! is ParametricTolerance.
0070   //! Raised if Abs (U2 - U1) <= ParametricTolerance.
0071   Standard_EXPORT Geom2dConvert_BSplineCurveToBezierCurve(
0072     const Handle(Geom2d_BSplineCurve)& BasisCurve,
0073     const Standard_Real                U1,
0074     const Standard_Real                U2,
0075     const Standard_Real                ParametricTolerance);
0076 
0077   //! Constructs and returns the Bezier curve of index
0078   //! Index to the table of adjacent Bezier arcs
0079   //! computed by this algorithm.
0080   //! This Bezier curve has the same orientation as the
0081   //! BSpline curve analyzed in this framework.
0082   //! Exceptions
0083   //! Standard_OutOfRange if Index is less than 1 or
0084   //! greater than the number of adjacent Bezier arcs
0085   //! computed by this algorithm.
0086   Standard_EXPORT Handle(Geom2d_BezierCurve) Arc(const Standard_Integer Index);
0087 
0088   //! Constructs all the Bezier curves whose data is
0089   //! computed by this algorithm and loads these curves
0090   //! into the Curves table.
0091   //! The Bezier curves have the same orientation as the
0092   //! BSpline curve analyzed in this framework.
0093   //! Exceptions
0094   //! Standard_DimensionError if the Curves array was
0095   //! not created with the following bounds:
0096   //! -   1 , and
0097   //! -   the number of adjacent Bezier arcs computed by
0098   //! this algorithm (as given by the function NbArcs).
0099   Standard_EXPORT void Arcs(TColGeom2d_Array1OfBezierCurve& Curves);
0100 
0101   //! This methode returns the bspline's knots associated to
0102   //! the converted arcs
0103   //! Raises DimensionError if the length  of Curves is not equal to
0104   //! NbArcs +  1
0105   Standard_EXPORT void Knots(TColStd_Array1OfReal& TKnots) const;
0106 
0107   //! Returns the number of BezierCurve arcs.
0108   //! If at the creation time you have decomposed the basis curve
0109   //! between the parametric values UFirst, ULast the number of
0110   //! BezierCurve arcs depends on the number of knots included inside
0111   //! the interval [UFirst, ULast].
0112   //! If you have decomposed the whole basis B-spline curve the number
0113   //! of BezierCurve arcs NbArcs is equal to the number of knots less
0114   //! one.
0115   Standard_EXPORT Standard_Integer NbArcs() const;
0116 
0117 protected:
0118 private:
0119   Handle(Geom2d_BSplineCurve) myCurve;
0120 };
0121 
0122 #endif // _Geom2dConvert_BSplineCurveToBezierCurve_HeaderFile