0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / GeomConvert / GeomConvert_BSplineCurveToBezierCurve.hxx
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
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 _GeomConvert_BSplineCurveToBezierCurve_HeaderFile
18 #define _GeomConvert_BSplineCurveToBezierCurve_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Real.hxx>
25 #include <Standard_Integer.hxx>
26 #include <TColGeom_Array1OfBezierCurve.hxx>
27 #include <TColStd_Array1OfReal.hxx>
28 class Geom_BSplineCurve;
29 class Standard_DimensionError;
30 class Standard_DomainError;
31 class Standard_OutOfRange;
32 class Geom_BezierCurve;
33
34
35 //! An algorithm to convert a BSpline curve into a series
36 //! of adjacent Bezier curves.
37 //! A BSplineCurveToBezierCurve object provides a framework for:
38 //! -   defining the BSpline curve to be converted
39 //! -   implementing the construction algorithm, and
40 //! -   consulting the results.
41 //! References :
42 //! Generating the Bezier points of B-spline curves and surfaces
43 //! (Wolfgang Bohm) CAD volume 13 number 6 november 1981
44 class GeomConvert_BSplineCurveToBezierCurve 
45 {
46 public:
47
48   DEFINE_STANDARD_ALLOC
49
50   
51   //! Computes all the data needed to convert the
52   //! BSpline curve BasisCurve into a series of adjacent Bezier arcs.
53   Standard_EXPORT GeomConvert_BSplineCurveToBezierCurve(const Handle(Geom_BSplineCurve)& BasisCurve);
54   
55   //! Computes all the data needed to convert
56   //! the portion of the BSpline curve BasisCurve
57   //! limited by the two parameter values U1 and U2 into a series of adjacent Bezier arcs.
58   //! The result consists of a series of BasisCurve arcs
59   //! limited by points corresponding to knot values of the curve.
60   //! Use the available interrogation functions to ascertain
61   //! the number of computed Bezier arcs, and then to
62   //! construct each individual Bezier curve (or all Bezier curves).
63   //! Note: ParametricTolerance is not used.
64   //! Raises DomainError if U1 or U2 are out of the parametric bounds of the basis
65   //! curve [FirstParameter, LastParameter]. The Tolerance criterion
66   //! is ParametricTolerance.
67   //! Raised if Abs (U2 - U1) <= ParametricTolerance.
68   Standard_EXPORT GeomConvert_BSplineCurveToBezierCurve(const Handle(Geom_BSplineCurve)& BasisCurve, const Standard_Real U1, const Standard_Real U2, const Standard_Real ParametricTolerance);
69   
70   //! Constructs and returns the Bezier curve of index
71   //! Index to the table of adjacent Bezier arcs
72   //! computed by this algorithm.
73   //! This Bezier curve has the same orientation as the
74   //! BSpline curve analyzed in this framework.
75   //! Exceptions
76   //! Standard_OutOfRange if Index is less than 1 or
77   //! greater than the number of adjacent Bezier arcs
78   //! computed by this algorithm.
79   Standard_EXPORT Handle(Geom_BezierCurve) Arc (const Standard_Integer Index);
80   
81   //! Constructs all the Bezier curves whose data is
82   //! computed by this algorithm and loads these curves into the Curves table.
83   //! The Bezier curves have the same orientation as the
84   //! BSpline curve analyzed in this framework.
85   //! Exceptions
86   //! Standard_DimensionError if the Curves array was
87   //! not created with the following bounds:
88   //! -   1 , and
89   //! -   the number of adjacent Bezier arcs computed by
90   //! this algorithm (as given by the function NbArcs).
91   Standard_EXPORT void Arcs (TColGeom_Array1OfBezierCurve& Curves);
92   
93   //! This methode returns the bspline's knots associated to
94   //! the converted arcs
95   //! Raised  if the length  of Curves is not equal to
96   //! NbArcs +  1.
97   Standard_EXPORT void Knots (TColStd_Array1OfReal& TKnots) const;
98   
99
100   //! Returns the number of BezierCurve arcs.
101   //! If at the creation time you have decomposed the basis curve
102   //! between the parametric values UFirst, ULast the number of
103   //! BezierCurve arcs depends on the number of knots included inside
104   //! the interval [UFirst, ULast].
105   //! If you have decomposed the whole basis B-spline curve the number
106   //! of BezierCurve arcs NbArcs is equal to the number of knots less
107   //! one.
108   Standard_EXPORT Standard_Integer NbArcs() const;
109
110
111
112
113 protected:
114
115
116
117
118
119 private:
120
121
122
123   Handle(Geom_BSplineCurve) myCurve;
124
125
126 };
127
128
129
130
131
132
133
134 #endif // _GeomConvert_BSplineCurveToBezierCurve_HeaderFile