Back to home page

EIC code displayed by LXR

 
 

    


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

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