Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:33

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