0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / Convert / Convert_ConicToBSplineCurve.hxx
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
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Convert_ConicToBSplineCurve_HeaderFile
18 #define _Convert_ConicToBSplineCurve_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TColgp_HArray1OfPnt2d.hxx>
25 #include <TColStd_HArray1OfReal.hxx>
26 #include <TColStd_HArray1OfInteger.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Standard_Boolean.hxx>
29 #include <Standard_Real.hxx>
30 #include <Convert_ParameterisationType.hxx>
31 class Standard_OutOfRange;
32 class Standard_ConstructionError;
33 class gp_Pnt2d;
34
35
36 //! Root class for algorithms which convert a conic curve into
37 //! a BSpline curve (CircleToBSplineCurve, EllipseToBSplineCurve,
38 //! HyperbolaToBSplineCurve, ParabolaToBSplineCurve).
39 //! These algorithms all work on 2D curves from the gp
40 //! package and compute all the data needed to construct a
41 //! BSpline curve equivalent to the conic curve. This data consists of:
42 //! -   the degree of the curve,
43 //! -   the periodic characteristics of the curve,
44 //! -   a poles table with associated weights,
45 //! -   a knots table with associated multiplicities.
46 //! The abstract class ConicToBSplineCurve provides a
47 //! framework for storing and consulting this computed data.
48 //! The data may then be used to construct a
49 //! Geom2d_BSplineCurve curvSuper class of the following classes :
50 //! This abstract class implements the methods to get the geometric
51 //! representation of the B-spline curve equivalent to the conic.
52 //! The B-spline is computed at the creation time in the sub classes.
53 //! The B-spline curve is defined with its degree, its control points
54 //! (Poles), its weights, its knots and their multiplicity.
55 //! All the geometric entities used in this package are defined in 2D
56 //! space.
57 //! KeyWords :
58 //! Convert, Conic, BSplineCurve, 2D.
59 class Convert_ConicToBSplineCurve 
60 {
61 public:
62
63   DEFINE_STANDARD_ALLOC
64
65   
66   //! Returns the degree of the BSpline curve whose data is
67   //! computed in this framework.
68   Standard_EXPORT Standard_Integer Degree() const;
69   
70   //! Returns the number of poles of the BSpline curve whose
71   //! data is computed in this framework.
72   Standard_EXPORT Standard_Integer NbPoles() const;
73   
74   //! Returns the number of knots of the BSpline curve whose
75   //! data is computed in this framework.
76   Standard_EXPORT Standard_Integer NbKnots() const;
77   
78   //! Returns true if the BSpline curve whose data is computed in
79   //! this framework is periodic.
80   Standard_EXPORT Standard_Boolean IsPeriodic() const;
81   
82   //! Returns the pole of index Index to the poles table of the
83   //! BSpline curve whose data is computed in this framework.
84   //! Exceptions
85   //! Standard_OutOfRange if Index is outside the bounds of
86   //! the poles table of the BSpline curve whose data is computed in this framework.
87   Standard_EXPORT gp_Pnt2d Pole (const Standard_Integer Index) const;
88   
89   //! Returns the weight of the pole of index Index to the poles
90   //! table of the BSpline curve whose data is computed in this framework.
91   //! Exceptions
92   //! Standard_OutOfRange if Index is outside the bounds of
93   //! the poles table of the BSpline curve whose data is computed in this framework.
94   Standard_EXPORT Standard_Real Weight (const Standard_Integer Index) const;
95   
96   //! Returns the knot of index Index to the knots table of the
97   //! BSpline curve whose data is computed in this framework.
98   //! Exceptions
99   //! Standard_OutOfRange if Index is outside the bounds of
100   //! the knots table of the BSpline curve whose data is computed in this framework.
101   Standard_EXPORT Standard_Real Knot (const Standard_Integer Index) const;
102   
103   //! Returns the multiplicity of the knot of index Index to the
104   //! knots table of the BSpline curve whose data is computed in this framework.
105   //! Exceptions
106   //! Standard_OutOfRange if Index is outside the bounds of
107   //! the knots table of the BSpline curve whose data is computed in this framework.
108   Standard_EXPORT Standard_Integer Multiplicity (const Standard_Integer Index) const;
109   
110   Standard_EXPORT void BuildCosAndSin (const Convert_ParameterisationType Parametrisation, Handle(TColStd_HArray1OfReal)& CosNumerator, Handle(TColStd_HArray1OfReal)& SinNumerator, Handle(TColStd_HArray1OfReal)& Denominator, Standard_Integer& Degree, Handle(TColStd_HArray1OfReal)& Knots, Handle(TColStd_HArray1OfInteger)& Mults) const;
111   
112   Standard_EXPORT void BuildCosAndSin (const Convert_ParameterisationType Parametrisation, const Standard_Real UFirst, const Standard_Real ULast, Handle(TColStd_HArray1OfReal)& CosNumerator, Handle(TColStd_HArray1OfReal)& SinNumerator, Handle(TColStd_HArray1OfReal)& Denominator, Standard_Integer& Degree, Handle(TColStd_HArray1OfReal)& Knots, Handle(TColStd_HArray1OfInteger)& Mults) const;
113
114
115
116
117 protected:
118
119   
120   Standard_EXPORT Convert_ConicToBSplineCurve(const Standard_Integer NumberOfPoles, const Standard_Integer NumberOfKnots, const Standard_Integer Degree);
121
122
123   Handle(TColgp_HArray1OfPnt2d) poles;
124   Handle(TColStd_HArray1OfReal) weights;
125   Handle(TColStd_HArray1OfReal) knots;
126   Handle(TColStd_HArray1OfInteger) mults;
127   Standard_Integer degree;
128   Standard_Integer nbPoles;
129   Standard_Integer nbKnots;
130   Standard_Boolean isperiodic;
131
132
133 private:
134
135
136
137
138
139 };
140
141
142
143
144
145
146
147 #endif // _Convert_ConicToBSplineCurve_HeaderFile