1 // Created on: 1991-10-10
2 // Created by: Jean Claude VAUTHIER
3 // Copyright (c) 1991-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 _Convert_ElementarySurfaceToBSplineSurface_HeaderFile
18 #define _Convert_ElementarySurfaceToBSplineSurface_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TColgp_Array2OfPnt.hxx>
25 #include <TColStd_Array2OfReal.hxx>
26 #include <TColStd_Array1OfReal.hxx>
27 #include <TColStd_Array1OfInteger.hxx>
28 #include <Standard_Boolean.hxx>
32 //! Root class for algorithms which convert an elementary
33 //! surface (cylinder, cone, sphere or torus) into a BSpline
34 //! surface (CylinderToBSplineSurface, ConeToBSplineSurface,
35 //! SphereToBSplineSurface, TorusToBSplineSurface).
36 //! These algorithms all work on elementary surfaces from
37 //! the gp package and compute all the data needed to
38 //! construct a BSpline surface equivalent to the cylinder,
39 //! cone, sphere or torus. This data consists of the following:
40 //! - degrees in the u and v parametric directions,
41 //! - periodic characteristics in the u and v parametric directions,
42 //! - a poles table with associated weights,
43 //! - a knots table (for the u and v parametric directions)
44 //! with associated multiplicities.
45 //! The abstract class
46 //! ElementarySurfaceToBSplineSurface provides a
47 //! framework for storing and consulting this computed data.
48 //! This data may then be used to construct a
49 //! Geom_BSplineSurface surface, for example.
50 //! All those classes define algorithms to convert an
51 //! ElementarySurface into a B-spline surface.
52 //! This abstract class implements the methods to get
53 //! the geometric representation of the B-spline surface.
54 //! The B-spline representation is computed at the creation
55 //! time in the sub classes.
56 //! The B-spline surface is defined with its degree in the
57 //! parametric U and V directions, its control points (Poles),
58 //! its weights, its knots and their multiplicity.
60 //! Convert, ElementarySurface, BSplineSurface.
61 class Convert_ElementarySurfaceToBSplineSurface
68 Standard_EXPORT Standard_Integer UDegree() const;
70 //! Returns the degree for the u or v parametric direction of
71 //! the BSpline surface whose data is computed in this framework.
72 Standard_EXPORT Standard_Integer VDegree() const;
74 Standard_EXPORT Standard_Integer NbUPoles() const;
76 //! Returns the number of poles for the u or v parametric
77 //! direction of the BSpline surface whose data is computed in this framework.
78 Standard_EXPORT Standard_Integer NbVPoles() const;
80 Standard_EXPORT Standard_Integer NbUKnots() const;
82 //! Returns the number of knots for the u or v parametric
83 //! direction of the BSpline surface whose data is computed in this framework .
84 Standard_EXPORT Standard_Integer NbVKnots() const;
86 Standard_EXPORT Standard_Boolean IsUPeriodic() const;
88 //! Returns true if the BSpline surface whose data is computed
89 //! in this framework is periodic in the u or v parametric direction.
90 Standard_EXPORT Standard_Boolean IsVPeriodic() const;
92 //! Returns the pole of index (UIndex,VIndex) to the poles
93 //! table of the BSpline surface whose data is computed in this framework.
95 //! Standard_OutOfRange if, for the BSpline surface whose
96 //! data is computed in this framework:
97 //! - UIndex is outside the bounds of the poles table in the u
98 //! parametric direction, or
99 //! - VIndex is outside the bounds of the poles table in the v
100 //! parametric direction.
101 Standard_EXPORT gp_Pnt Pole (const Standard_Integer UIndex, const Standard_Integer VIndex) const;
103 //! Returns the weight of the pole of index (UIndex,VIndex) to
104 //! the poles table of the BSpline surface whose data is computed in this framework.
106 //! Standard_OutOfRange if, for the BSpline surface whose
107 //! data is computed in this framework:
108 //! - UIndex is outside the bounds of the poles table in the u
109 //! parametric direction, or
110 //! - VIndex is outside the bounds of the poles table in the v
111 //! parametric direction.
112 Standard_EXPORT Standard_Real Weight (const Standard_Integer UIndex, const Standard_Integer VIndex) const;
114 //! Returns the U-knot of range UIndex.
115 //! Raised if UIndex < 1 or UIndex > NbUKnots.
116 Standard_EXPORT Standard_Real UKnot (const Standard_Integer UIndex) const;
118 //! Returns the V-knot of range VIndex.
119 //! Raised if VIndex < 1 or VIndex > NbVKnots.
120 Standard_EXPORT Standard_Real VKnot (const Standard_Integer UIndex) const;
122 //! Returns the multiplicity of the U-knot of range UIndex.
123 //! Raised if UIndex < 1 or UIndex > NbUKnots.
124 Standard_EXPORT Standard_Integer UMultiplicity (const Standard_Integer UIndex) const;
126 //! Returns the multiplicity of the V-knot of range VIndex.
127 //! Raised if VIndex < 1 or VIndex > NbVKnots.
128 Standard_EXPORT Standard_Integer VMultiplicity (const Standard_Integer VIndex) const;
136 Standard_EXPORT Convert_ElementarySurfaceToBSplineSurface(const Standard_Integer NumberOfUPoles, const Standard_Integer NumberOfVPoles, const Standard_Integer NumberOfUKnots, const Standard_Integer NumberOfVKnots, const Standard_Integer UDegree, const Standard_Integer VDegree);
139 TColgp_Array2OfPnt poles;
140 TColStd_Array2OfReal weights;
141 TColStd_Array1OfReal uknots;
142 TColStd_Array1OfInteger umults;
143 TColStd_Array1OfReal vknots;
144 TColStd_Array1OfInteger vmults;
145 Standard_Integer udegree;
146 Standard_Integer vdegree;
147 Standard_Integer nbUPoles;
148 Standard_Integer nbVPoles;
149 Standard_Integer nbUKnots;
150 Standard_Integer nbVKnots;
151 Standard_Boolean isuperiodic;
152 Standard_Boolean isvperiodic;
169 #endif // _Convert_ElementarySurfaceToBSplineSurface_HeaderFile