0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / GeomConvert / GeomConvert_BSplineSurfaceKnotSplitting.hxx
1 // Created on: 1991-10-04
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _GeomConvert_BSplineSurfaceKnotSplitting_HeaderFile
17 #define _GeomConvert_BSplineSurfaceKnotSplitting_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
22
23 #include <TColStd_HArray1OfInteger.hxx>
24 #include <Standard_Integer.hxx>
25 #include <TColStd_Array1OfInteger.hxx>
26 class Standard_DimensionError;
27 class Standard_RangeError;
28 class Geom_BSplineSurface;
29
30
31 //! An algorithm to determine isoparametric curves along
32 //! which a BSpline surface should be split in order to
33 //! obtain patches of the same continuity. The continuity order is given at the
34 //! construction time. It is possible to compute the surface patches
35 //! corresponding to the splitting with the method of package
36 //! SplitBSplineSurface.
37 //! For a B-spline surface the discontinuities are localised at
38 //! the knot values. Between two knots values the B-spline is
39 //! infinitely continuously differentiable.  For each parametric
40 //! direction at a knot of range index the continuity in this
41 //! direction is equal to :  Degree - Mult (Index)   where  Degree
42 //! is the degree of the basis B-spline functions and Mult the
43 //! multiplicity of the knot of range Index in the given direction.
44 //! If for your computation you need to have B-spline surface with a
45 //! minima of continuity it can be interesting to know between which
46 //! knot values, a B-spline patch, has a continuity of given order.
47 //! This algorithm computes the indexes of the knots where you should
48 //! split the surface, to obtain patches with a constant continuity
49 //! given at the construction time. If you just want to compute the
50 //! local derivatives on the surface you don't need to create the
51 //! BSpline patches, you can use the functions LocalD1, LocalD2,
52 //! LocalD3, LocalDN of the class BSplineSurface from package Geom.
53 class GeomConvert_BSplineSurfaceKnotSplitting 
54 {
55 public:
56
57   DEFINE_STANDARD_ALLOC
58
59   
60   //! Determines the u- and v-isoparametric curves
61   //! along which the BSpline surface BasisSurface
62   //! should be split in order to obtain patches with a
63   //! degree of continuity equal to UContinuityRange in
64   //! the u parametric direction, and to
65   //! VContinuityRange in the v parametric direction.
66   //! These isoparametric curves are defined by
67   //! parameters, which are BasisSurface knot values in
68   //! the u or v parametric direction. They are identified
69   //! by indices in the BasisSurface knots table in the
70   //! corresponding parametric direction.
71   //! Use the available interrogation functions to access
72   //! computed values, followed by the global function
73   //! SplitBSplineSurface (provided by the package
74   //! GeomConvert) to split the surface.
75   //! Exceptions
76   //! Standard_RangeError if UContinuityRange or
77   //! VContinuityRange is less than zero.
78   Standard_EXPORT GeomConvert_BSplineSurfaceKnotSplitting(const Handle(Geom_BSplineSurface)& BasisSurface, const Standard_Integer UContinuityRange, const Standard_Integer VContinuityRange);
79   
80   //! Returns the number of u-isoparametric curves
81   //! along which the analysed BSpline surface should be
82   //! split in order to obtain patches with the continuity
83   //! required by this framework.
84   //! The parameters which define these curves are knot
85   //! values in the corresponding parametric direction.
86   //! Note that the four curves which bound the surface are
87   //! counted among these splitting curves.
88   Standard_EXPORT Standard_Integer NbUSplits() const;
89   
90   //! Returns the number of v-isoparametric curves
91   //! along which the analysed BSpline surface should be
92   //! split in order to obtain patches with the continuity
93   //! required by this framework.
94   //! The parameters which define these curves are knot
95   //! values in the corresponding parametric direction.
96   //! Note that the four curves which bound the surface are
97   //! counted among these splitting curves.
98   Standard_EXPORT Standard_Integer NbVSplits() const;
99   
100   //! Loads the USplit and VSplit tables with the split
101   //! knots values computed in this framework. Each value
102   //! in these tables is an index in the knots table
103   //! corresponding to the u or v parametric direction of
104   //! the BSpline surface analysed by this algorithm.
105   //! The USplit and VSplit values are given in ascending
106   //! order and comprise the indices of the knots which
107   //! give the first and last isoparametric curves of the
108   //! surface in the corresponding parametric direction.
109   //! Use two consecutive values from the USplit table and
110   //! two consecutive values from the VSplit table as
111   //! arguments of the global function
112   //! SplitBSplineSurface (provided by the package
113   //! GeomConvert) to split the surface.
114   //! Exceptions
115   //! Standard_DimensionError if:
116   //! -   the array USplit was not created with the following bounds:
117   //! -   1 , and
118   //! -   the number of split knots in the u parametric
119   //! direction computed in this framework (as given
120   //! by the function NbUSplits); or
121   //! -   the array VSplit was not created with the following bounds:
122   //! -   1 , and
123   //! -   the number of split knots in the v parametric
124   //! direction computed in this framework (as given
125   //! by the function NbVSplits).
126   Standard_EXPORT void Splitting (TColStd_Array1OfInteger& USplit, TColStd_Array1OfInteger& VSplit) const;
127   
128   //! Returns the split knot of index UIndex
129   //! to the split knots table for the u  parametric direction
130   //! computed in this framework. The returned value is
131   //! an index in the knots table relative to the u
132   //! parametric direction of the BSpline surface analysed by this algorithm.
133   //! Note: If UIndex is equal to 1, or to the number of split knots for the u
134   //! parametric direction computed in
135   //! this framework, the corresponding knot gives the
136   //! parameter of one of the bounding curves of the surface.
137   //! Exceptions
138   //! Standard_RangeError if UIndex  is less than 1 or greater than the number
139   //! of split knots for the u parametric direction computed in this framework.
140   Standard_EXPORT Standard_Integer USplitValue (const Standard_Integer UIndex) const;
141   
142   //! Returns the split knot of index VIndex
143   //! to the split knots table for the v  parametric direction
144   //! computed in this framework. The returned value is
145   //! an index in the knots table relative to the v
146   //! parametric direction of the BSpline surface analysed by this algorithm.
147   //! Note: If UIndex is equal to 1, or to the number of split knots for the v
148   //! parametric direction computed in
149   //! this framework, the corresponding knot gives the
150   //! parameter of one of the bounding curves of the surface.
151   //! Exceptions
152   //! Standard_RangeError if VIndex  is less than 1 or greater than the number
153   //! of split knots for the v parametric direction computed in this framework.
154   Standard_EXPORT Standard_Integer VSplitValue (const Standard_Integer VIndex) const;
155
156
157
158
159 protected:
160
161
162
163
164
165 private:
166
167
168
169   Handle(TColStd_HArray1OfInteger) usplitIndexes;
170   Handle(TColStd_HArray1OfInteger) vsplitIndexes;
171
172
173 };
174
175
176
177
178
179
180
181 #endif // _GeomConvert_BSplineSurfaceKnotSplitting_HeaderFile