Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1993-10-20
0002 // Created by: Bruno DUMORTIER
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 _Convert_CompBezierCurvesToBSplineCurve_HeaderFile
0018 #define _Convert_CompBezierCurvesToBSplineCurve_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <Convert_SequenceOfArray1OfPoles.hxx>
0024 #include <TColgp_SequenceOfPnt.hxx>
0025 #include <TColStd_SequenceOfReal.hxx>
0026 #include <TColStd_SequenceOfInteger.hxx>
0027 #include <TColgp_Array1OfPnt.hxx>
0028 #include <TColStd_Array1OfReal.hxx>
0029 #include <TColStd_Array1OfInteger.hxx>
0030 
0031 
0032 //! An algorithm to convert a sequence of adjacent
0033 //! non-rational Bezier curves into a BSpline curve.
0034 //! A CompBezierCurvesToBSplineCurve object provides a framework for:
0035 //! -   defining the sequence of adjacent non-rational Bezier
0036 //! curves to be converted into a BSpline curve,
0037 //! -   implementing the computation algorithm, and
0038 //! -   consulting the results.
0039 //! Warning
0040 //! Do not attempt to convert rational Bezier curves using this type of algorithm.
0041 class Convert_CompBezierCurvesToBSplineCurve 
0042 {
0043 public:
0044 
0045   DEFINE_STANDARD_ALLOC
0046 
0047   
0048   //! Constructs a framework for converting a sequence of
0049   //! adjacent non-rational Bezier curves into a BSpline curve.
0050   //! Knots will be created on the computed BSpline curve at
0051   //! each junction point of two consecutive Bezier curves. The
0052   //! degree of continuity of the BSpline curve will be increased at
0053   //! the junction point of two consecutive Bezier curves if their
0054   //! tangent vectors at this point are parallel. AngularTolerance
0055   //! (given in radians, and defaulted to 1.0 e-4) will be used
0056   //! to check the parallelism of the two tangent vectors.
0057   //! Use the following functions:
0058   //! -   AddCurve to define in sequence the adjacent Bezier
0059   //! curves to be converted,
0060   //! -   Perform to compute the data needed to build the BSpline curve,
0061   //! -   and the available consultation functions to access the
0062   //! computed data. This data may be used to construct the BSpline curve.
0063   Standard_EXPORT Convert_CompBezierCurvesToBSplineCurve(const Standard_Real AngularTolerance = 1.0e-4);
0064   
0065   //! Adds the Bezier curve defined by the table of poles Poles, to
0066   //! the sequence (still contained in this framework) of adjacent
0067   //! Bezier curves to be converted into a BSpline curve.
0068   //! Only polynomial (i.e. non-rational) Bezier curves are
0069   //! converted using this framework.
0070   //! If this is not the first call to the function (i.e. if this framework
0071   //! still contains data in its Bezier curve sequence), the degree
0072   //! of continuity of the BSpline curve will be increased at the
0073   //! time of computation at the first point of the added Bezier
0074   //! curve (i.e. the first point of the Poles table). This will be the
0075   //! case if the tangent vector of the curve at this point is
0076   //! parallel to the tangent vector at the end point of the
0077   //! preceding Bezier curve in the Bezier curve sequence still
0078   //! contained in this framework. An angular tolerance given at
0079   //! the time of construction of this framework will be used to
0080   //! check the parallelism of the two tangent vectors. This
0081   //! checking procedure and all related computations will be
0082   //! performed by the Perform function.
0083   //! When the adjacent Bezier curve sequence is complete, use
0084   //! the following functions:
0085   //! -   Perform to compute the data needed to build the BSpline curve,
0086   //! -   and the available consultation functions to access the
0087   //! computed data. This data may be used to construct the BSpline curve.
0088   //! Warning
0089   //! The Bezier curve sequence treated by this framework is
0090   //! automatically initialized with the first Bezier curve when the
0091   //! function is first called. During subsequent use of this function,
0092   //! ensure that the first point of the added Bezier curve (i.e. the
0093   //! first point of the Poles table) is coincident with the last point
0094   //! of the Bezier curve sequence (i.e. the last point of the
0095   //! preceding Bezier curve in the sequence) still contained in
0096   //! this framework. An error may occur at the time of
0097   //! computation if this condition is not satisfied. Particular care
0098   //! must be taken with respect to the above, as this condition is
0099   //! not checked either when defining the Bezier curve
0100   //! sequence or at the time of computation.
0101   Standard_EXPORT void AddCurve (const TColgp_Array1OfPnt& Poles);
0102   
0103   //! Computes all the data needed to build a BSpline curve
0104   //! equivalent to the adjacent Bezier curve sequence still
0105   //! contained in this framework.
0106   //! A knot is inserted on the computed BSpline curve at the
0107   //! junction point of two consecutive Bezier curves. The
0108   //! degree of continuity of the BSpline curve will be increased
0109   //! at the junction point of two consecutive Bezier curves if
0110   //! their tangent vectors at this point are parallel. An angular
0111   //! tolerance given at the time of construction of this
0112   //! framework is used to check the parallelism of the two
0113   //! tangent vectors.
0114   //! Use the available consultation functions to access the
0115   //! computed data. This data may then be used to construct
0116   //! the BSpline curve.
0117   //! Warning
0118   //! Make sure that the curves in the Bezier curve sequence
0119   //! contained in this framework are adjacent. An error may
0120   //! occur at the time of computation if this condition is not
0121   //! satisfied. Particular care must be taken with respect to the
0122   //! above as this condition is not checked, either when
0123   //! defining the Bezier curve sequence or at the time of computation.
0124   Standard_EXPORT void Perform();
0125   
0126   //! Returns the degree of the BSpline curve whose data is
0127   //! computed in this framework.
0128   //! Warning
0129   //! Take particular care not to use this function before the
0130   //! computation is performed (Perform function), as this
0131   //! condition is not checked and an error may  therefore occur.
0132   Standard_EXPORT Standard_Integer Degree() const;
0133   
0134   //! Returns the number of poles of the BSpline curve whose
0135   //! data is computed in this framework.
0136   //! Warning
0137   //! Take particular care not to use this function before the
0138   //! computation is performed (Perform function), as this
0139   //! condition is not checked and an error may therefore occur.
0140   Standard_EXPORT Standard_Integer NbPoles() const;
0141   
0142   //! Loads the Poles table with the poles of the BSpline curve
0143   //! whose data is computed in this framework.
0144   //! Warning
0145   //! -   Do not use this function before the computation is
0146   //! performed (Perform function).
0147   //! -   The length of the Poles array must be equal to the
0148   //! number of poles of the BSpline curve whose data is
0149   //! computed in this framework.
0150   //! Particular care must be taken with respect to the above, as
0151   //! these conditions are not checked, and an error may occur.
0152   Standard_EXPORT void Poles (TColgp_Array1OfPnt& Poles) const;
0153   
0154   //! Returns the number of knots of the BSpline curve whose
0155   //! data is computed in this framework.
0156   //! Warning
0157   //! Take particular care not to use this function before the
0158   //! computation is performed (Perform function), as this
0159   //! condition is not checked and an error may therefore occur.
0160   Standard_EXPORT Standard_Integer NbKnots() const;
0161   
0162 
0163   //! -   loads the Knots table with the knots,
0164   //! -   and loads the Mults table with the corresponding multiplicities
0165   //! of the BSpline curve whose data is computed in this framework.
0166   //! Warning
0167   //! -   Do not use this function before the computation is
0168   //! performed (Perform function).
0169   //! -   The length of the Knots and Mults arrays must be equal
0170   //! to the number of knots in the BSpline curve whose data is
0171   //! computed in this framework.
0172   //! Particular care must be taken with respect to the above as
0173   //! these conditions are not checked, and an error may occur.
0174   Standard_EXPORT void KnotsAndMults (TColStd_Array1OfReal& Knots, TColStd_Array1OfInteger& Mults) const;
0175 
0176 
0177 
0178 
0179 protected:
0180 
0181 
0182 
0183 
0184 
0185 private:
0186 
0187 
0188 
0189   Convert_SequenceOfArray1OfPoles mySequence;
0190   TColgp_SequenceOfPnt CurvePoles;
0191   TColStd_SequenceOfReal CurveKnots;
0192   TColStd_SequenceOfInteger KnotsMultiplicities;
0193   Standard_Integer myDegree;
0194   Standard_Real myAngular;
0195   Standard_Boolean myDone;
0196 
0197 
0198 };
0199 
0200 
0201 
0202 
0203 
0204 
0205 
0206 #endif // _Convert_CompBezierCurvesToBSplineCurve_HeaderFile