Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03: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_BSplineSurfaceToBezierSurface_HeaderFile
0018 #define _GeomConvert_BSplineSurfaceToBezierSurface_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <TColGeom_Array2OfBezierSurface.hxx>
0026 #include <TColStd_Array1OfReal.hxx>
0027 class Geom_BSplineSurface;
0028 class Geom_BezierSurface;
0029 
0030 
0031 
0032 //! This algorithm converts a B-spline surface into several
0033 //! Bezier surfaces. It uses an algorithm of knot insertion.
0034 //! A BSplineSurfaceToBezierSurface object provides a framework for:
0035 //! -   defining the BSpline surface to be converted,
0036 //! -   implementing the construction algorithm, and
0037 //! -   consulting the results.
0038 //! References :
0039 //! Generating the Bezier points of B-spline curves and surfaces
0040 //! (Wolfgang Bohm) CAD volume 13 number 6 november 1981
0041 class GeomConvert_BSplineSurfaceToBezierSurface 
0042 {
0043 public:
0044 
0045   DEFINE_STANDARD_ALLOC
0046 
0047   
0048   //! Computes all the data needed to convert
0049   //! -   the BSpline surface BasisSurface into a series of adjacent Bezier surfaces.
0050   //! The result consists of a grid of BasisSurface patches
0051   //! limited by isoparametric curves corresponding to knot
0052   //! values, both in the u and v parametric directions of
0053   //! the surface. A row in the grid corresponds to a series
0054   //! of adjacent patches, all limited by the same two
0055   //! u-isoparametric curves. A column in the grid
0056   //! corresponds to a series of adjacent patches, all
0057   //! limited by the same two v-isoparametric curves.
0058   //! Use the available interrogation functions to ascertain
0059   //! the number of computed Bezier patches, and then to
0060   //! construct each individual Bezier surface (or all Bezier surfaces).
0061   //! Note: ParametricTolerance is not used.
0062   Standard_EXPORT GeomConvert_BSplineSurfaceToBezierSurface(const Handle(Geom_BSplineSurface)& BasisSurface);
0063   
0064   //! Computes all the data needed to convert
0065   //! the patch of the BSpline surface BasisSurface
0066   //! limited by the two parameter values U1 and U2 in
0067   //! the u parametric direction, and by the two
0068   //! parameter values V1 and V2 in the v parametric
0069   //! direction, into a series of adjacent Bezier surfaces.
0070   //! The result consists of a grid of BasisSurface patches
0071   //! limited by isoparametric curves corresponding to knot
0072   //! values, both in the u and v parametric directions of
0073   //! the surface. A row in the grid corresponds to a series
0074   //! of adjacent patches, all limited by the same two
0075   //! u-isoparametric curves. A column in the grid
0076   //! corresponds to a series of adjacent patches, all
0077   //! limited by the same two v-isoparametric curves.
0078   //! Use the available interrogation functions to ascertain
0079   //! the number of computed Bezier patches, and then to
0080   //! construct each individual Bezier surface (or all Bezier surfaces).
0081   //! Note: ParametricTolerance is not used.  Raises DomainError
0082   //! if U1 or U2 or V1 or V2 are out of the parametric bounds
0083   //! of the basis surface [FirstUKnotIndex, LastUKnotIndex] ,
0084   //! [FirstVKnotIndex, LastVKnotIndex] The tolerance criterion is
0085   //! ParametricTolerance.
0086   //! Raised if U2 - U1 <= ParametricTolerance or
0087   //! V2 - V1 <= ParametricTolerance.
0088   Standard_EXPORT GeomConvert_BSplineSurfaceToBezierSurface(const Handle(Geom_BSplineSurface)& BasisSurface, const Standard_Real U1, const Standard_Real U2, const Standard_Real V1, const Standard_Real V2, const Standard_Real ParametricTolerance);
0089   
0090   //! Constructs and returns the Bezier surface of indices
0091   //! (UIndex, VIndex) to the patch grid computed on the
0092   //! BSpline surface analyzed by this algorithm.
0093   //! This Bezier surface has the same orientation as the
0094   //! BSpline surface analyzed in this framework.
0095   //! UIndex is an index common to a row in the patch
0096   //! grid. A row in the grid corresponds to a series of
0097   //! adjacent patches, all limited by the same two
0098   //! u-isoparametric curves of the surface. VIndex is an
0099   //! index common to a column in the patch grid. A column
0100   //! in the grid corresponds to a series of adjacent
0101   //! patches, all limited by the same two v-isoparametric
0102   //! curves of the surface.
0103   //! Exceptions
0104   //! Standard_OutOfRange if:
0105   //! -   UIndex is less than 1 or greater than the number
0106   //! of rows in the patch grid computed on the BSpline
0107   //! surface analyzed by this algorithm (as returned by
0108   //! the function NbUPatches); or if
0109   //! -   VIndex is less than 1 or greater than the number
0110   //! of columns in the patch grid computed on the
0111   //! BSpline surface analyzed by this algorithm (as
0112   //! returned by the function NbVPatches).
0113   Standard_EXPORT Handle(Geom_BezierSurface) Patch (const Standard_Integer UIndex, const Standard_Integer VIndex);
0114   
0115   //! Constructs all the Bezier surfaces whose data is
0116   //! computed by this algorithm, and loads them into the Surfaces table.
0117   //! These Bezier surfaces have the same orientation as
0118   //! the BSpline surface analyzed in this framework.
0119   //! The Surfaces array is organised in the same way as
0120   //! the patch grid computed on the BSpline surface
0121   //! analyzed by this algorithm. A row in the array
0122   //! corresponds to a series of adjacent patches, all
0123   //! limited by the same two u-isoparametric curves of
0124   //! the surface. A column in the array corresponds to a
0125   //! series of adjacent patches, all limited by the same two
0126   //! v-isoparametric curves of the surface.
0127   //! Exceptions
0128   //! Standard_DimensionError if the Surfaces array
0129   //! was not created with the following bounds:
0130   //! -   1, and the number of adjacent patch series in the
0131   //! u parametric direction of the patch grid computed
0132   //! on the BSpline surface, analyzed by this algorithm
0133   //! (as given by the function NbUPatches) as row bounds,
0134   //! -   1, and the number of adjacent patch series in the
0135   //! v parametric direction of the patch grid computed
0136   //! on the BSpline surface, analyzed by this algorithm
0137   //! (as given by the function NbVPatches) as column bounds.
0138   Standard_EXPORT void Patches (TColGeom_Array2OfBezierSurface& Surfaces);
0139   
0140   //! This methode returns the bspline's u-knots associated to
0141   //! the converted Patches
0142   //! Raised  if the length  of Curves is not equal to
0143   //! NbUPatches +  1.
0144   Standard_EXPORT void UKnots (TColStd_Array1OfReal& TKnots) const;
0145   
0146   //! This methode returns the bspline's v-knots associated to
0147   //! the converted Patches
0148   //! Raised  if the length  of Curves is not equal to
0149   //! NbVPatches +  1.
0150   Standard_EXPORT void VKnots (TColStd_Array1OfReal& TKnots) const;
0151   
0152 
0153   //! Returns the number of Bezier surfaces in the U direction.
0154   //! If at the creation time you have decomposed the basis Surface
0155   //! between the parametric values UFirst, ULast the number of
0156   //! Bezier surfaces in the U direction depends on the number of
0157   //! knots included inside the interval [UFirst, ULast].
0158   //! If you have decomposed the whole basis B-spline surface the
0159   //! number of Bezier surfaces NbUPatches is equal to the number of
0160   //! UKnots less one.
0161   Standard_EXPORT Standard_Integer NbUPatches() const;
0162   
0163 
0164   //! Returns the number of Bezier surfaces in the V direction.
0165   //! If at the creation time you have decomposed the basis surface
0166   //! between the parametric values VFirst, VLast the number of
0167   //! Bezier surfaces in the V direction depends on the number of
0168   //! knots included inside the interval [VFirst, VLast].
0169   //! If you have decomposed the whole basis B-spline surface the
0170   //! number of Bezier surfaces NbVPatches is equal to the number of
0171   //! VKnots less one.
0172   Standard_EXPORT Standard_Integer NbVPatches() const;
0173 
0174 
0175 
0176 
0177 protected:
0178 
0179 
0180 
0181 
0182 
0183 private:
0184 
0185 
0186 
0187   Handle(Geom_BSplineSurface) mySurface;
0188 
0189 
0190 };
0191 
0192 
0193 
0194 
0195 
0196 
0197 
0198 #endif // _GeomConvert_BSplineSurfaceToBezierSurface_HeaderFile