1 // Created on: 1996-03-12
2 // Created by: Bruno DUMORTIER
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _GeomConvert_BSplineSurfaceToBezierSurface_HeaderFile
18 #define _GeomConvert_BSplineSurfaceToBezierSurface_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Real.hxx>
25 #include <Standard_Integer.hxx>
26 #include <TColGeom_Array2OfBezierSurface.hxx>
27 #include <TColStd_Array1OfReal.hxx>
28 class Geom_BSplineSurface;
29 class Standard_DimensionError;
30 class Standard_DomainError;
31 class Standard_OutOfRange;
32 class Geom_BezierSurface;
36 //! This algorithm converts a B-spline surface into several
37 //! Bezier surfaces. It uses an algorithm of knot insertion.
38 //! A BSplineSurfaceToBezierSurface object provides a framework for:
39 //! - defining the BSpline surface to be converted,
40 //! - implementing the construction algorithm, and
41 //! - consulting the results.
43 //! Generating the Bezier points of B-spline curves and surfaces
44 //! (Wolfgang Bohm) CAD volume 13 number 6 november 1981
45 class GeomConvert_BSplineSurfaceToBezierSurface
52 //! Computes all the data needed to convert
53 //! - the BSpline surface BasisSurface into a series of adjacent Bezier surfaces.
54 //! The result consists of a grid of BasisSurface patches
55 //! limited by isoparametric curves corresponding to knot
56 //! values, both in the u and v parametric directions of
57 //! the surface. A row in the grid corresponds to a series
58 //! of adjacent patches, all limited by the same two
59 //! u-isoparametric curves. A column in the grid
60 //! corresponds to a series of adjacent patches, all
61 //! limited by the same two v-isoparametric curves.
62 //! Use the available interrogation functions to ascertain
63 //! the number of computed Bezier patches, and then to
64 //! construct each individual Bezier surface (or all Bezier surfaces).
65 //! Note: ParametricTolerance is not used.
66 Standard_EXPORT GeomConvert_BSplineSurfaceToBezierSurface(const Handle(Geom_BSplineSurface)& BasisSurface);
68 //! Computes all the data needed to convert
69 //! the patch of the BSpline surface BasisSurface
70 //! limited by the two parameter values U1 and U2 in
71 //! the u parametric direction, and by the two
72 //! parameter values V1 and V2 in the v parametric
73 //! direction, into a series of adjacent Bezier surfaces.
74 //! The result consists of a grid of BasisSurface patches
75 //! limited by isoparametric curves corresponding to knot
76 //! values, both in the u and v parametric directions of
77 //! the surface. A row in the grid corresponds to a series
78 //! of adjacent patches, all limited by the same two
79 //! u-isoparametric curves. A column in the grid
80 //! corresponds to a series of adjacent patches, all
81 //! limited by the same two v-isoparametric curves.
82 //! Use the available interrogation functions to ascertain
83 //! the number of computed Bezier patches, and then to
84 //! construct each individual Bezier surface (or all Bezier surfaces).
85 //! Note: ParametricTolerance is not used. Raises DomainError
86 //! if U1 or U2 or V1 or V2 are out of the parametric bounds
87 //! of the basis surface [FirstUKnotIndex, LastUKnotIndex] ,
88 //! [FirstVKnotIndex, LastVKnotIndex] The tolerance criterion is
89 //! ParametricTolerance.
90 //! Raised if U2 - U1 <= ParametricTolerance or
91 //! V2 - V1 <= ParametricTolerance.
92 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);
94 //! Constructs and returns the Bezier surface of indices
95 //! (UIndex, VIndex) to the patch grid computed on the
96 //! BSpline surface analyzed by this algorithm.
97 //! This Bezier surface has the same orientation as the
98 //! BSpline surface analyzed in this framework.
99 //! UIndex is an index common to a row in the patch
100 //! grid. A row in the grid corresponds to a series of
101 //! adjacent patches, all limited by the same two
102 //! u-isoparametric curves of the surface. VIndex is an
103 //! index common to a column in the patch grid. A column
104 //! in the grid corresponds to a series of adjacent
105 //! patches, all limited by the same two v-isoparametric
106 //! curves of the surface.
108 //! Standard_OutOfRange if:
109 //! - UIndex is less than 1 or greater than the number
110 //! of rows in the patch grid computed on the BSpline
111 //! surface analyzed by this algorithm (as returned by
112 //! the function NbUPatches); or if
113 //! - VIndex is less than 1 or greater than the number
114 //! of columns in the patch grid computed on the
115 //! BSpline surface analyzed by this algorithm (as
116 //! returned by the function NbVPatches).
117 Standard_EXPORT Handle(Geom_BezierSurface) Patch (const Standard_Integer UIndex, const Standard_Integer VIndex);
119 //! Constructs all the Bezier surfaces whose data is
120 //! computed by this algorithm, and loads them into the Surfaces table.
121 //! These Bezier surfaces have the same orientation as
122 //! the BSpline surface analyzed in this framework.
123 //! The Surfaces array is organised in the same way as
124 //! the patch grid computed on the BSpline surface
125 //! analyzed by this algorithm. A row in the array
126 //! corresponds to a series of adjacent patches, all
127 //! limited by the same two u-isoparametric curves of
128 //! the surface. A column in the array corresponds to a
129 //! series of adjacent patches, all limited by the same two
130 //! v-isoparametric curves of the surface.
132 //! Standard_DimensionError if the Surfaces array
133 //! was not created with the following bounds:
134 //! - 1, and the number of adjacent patch series in the
135 //! u parametric direction of the patch grid computed
136 //! on the BSpline surface, analyzed by this algorithm
137 //! (as given by the function NbUPatches) as row bounds,
138 //! - 1, and the number of adjacent patch series in the
139 //! v parametric direction of the patch grid computed
140 //! on the BSpline surface, analyzed by this algorithm
141 //! (as given by the function NbVPatches) as column bounds.
142 Standard_EXPORT void Patches (TColGeom_Array2OfBezierSurface& Surfaces);
144 //! This methode returns the bspline's u-knots associated to
145 //! the converted Patches
146 //! Raised if the length of Curves is not equal to
148 Standard_EXPORT void UKnots (TColStd_Array1OfReal& TKnots) const;
150 //! This methode returns the bspline's v-knots associated to
151 //! the converted Patches
152 //! Raised if the length of Curves is not equal to
154 Standard_EXPORT void VKnots (TColStd_Array1OfReal& TKnots) const;
157 //! Returns the number of Bezier surfaces in the U direction.
158 //! If at the creation time you have decomposed the basis Surface
159 //! between the parametric values UFirst, ULast the number of
160 //! Bezier surfaces in the U direction depends on the number of
161 //! knots included inside the interval [UFirst, ULast].
162 //! If you have decomposed the whole basis B-spline surface the
163 //! number of Bezier surfaces NbUPatches is equal to the number of
165 Standard_EXPORT Standard_Integer NbUPatches() const;
168 //! Returns the number of Bezier surfaces in the V direction.
169 //! If at the creation time you have decomposed the basis surface
170 //! between the parametric values VFirst, VLast the number of
171 //! Bezier surfaces in the V direction depends on the number of
172 //! knots included inside the interval [VFirst, VLast].
173 //! If you have decomposed the whole basis B-spline surface the
174 //! number of Bezier surfaces NbVPatches is equal to the number of
176 Standard_EXPORT Standard_Integer NbVPatches() const;
191 Handle(Geom_BSplineSurface) mySurface;
202 #endif // _GeomConvert_BSplineSurfaceToBezierSurface_HeaderFile