0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / Geom2dConvert / Geom2dConvert_BSplineCurveKnotSplitting.hxx
CommitLineData
42cf5bc1 1// Created on: 1991-10-03
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 _Geom2dConvert_BSplineCurveKnotSplitting_HeaderFile
17#define _Geom2dConvert_BSplineCurveKnotSplitting_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>
26class Standard_DimensionError;
27class Standard_RangeError;
28class Geom2d_BSplineCurve;
29
30
31//! An algorithm to determine points at which a BSpline
32//! curve should be split in order to obtain arcs of the same continuity.
33//! If you require curves with a minimum continuity for
34//! your computation, it is useful to know the points
35//! between which an arc has a continuity of a given
36//! order. The continuity order is given at the construction time.
37//! For a BSpline curve, the discontinuities are
38//! localized at the knot values. Between two knot values
39//! the BSpline is infinitely and continuously
40//! differentiable. At a given knot, the continuity is equal
41//! to: Degree - Mult, where Degree is the
42//! degree of the BSpline curve and Mult is the multiplicity of the knot.
43//! It is possible to compute the arcs which correspond to
44//! this splitting using the global function
45//! SplitBSplineCurve provided by the package Geom2dConvert.
46//! A BSplineCurveKnotSplitting object provides a framework for:
47//! - defining the curve to be analysed and the required degree of continuity,
48//! - implementing the computation algorithm, and
49//! - consulting the results.
50class Geom2dConvert_BSplineCurveKnotSplitting
51{
52public:
53
54 DEFINE_STANDARD_ALLOC
55
56
57 //! Determines points at which the BSpline curve
58 //! BasisCurve should be split in order to obtain arcs
59 //! with a degree of continuity equal to ContinuityRange.
60 //! These points are knot values of BasisCurve. They
61 //! are identified by indices in the knots table of BasisCurve.
62 //! Use the available interrogation functions to access
63 //! computed values, followed by the global function
64 //! SplitBSplineCurve (provided by the package
65 //! Geom2dConvert) to split the curve.
66 //! Exceptions
67 //! Standard_RangeError if ContinuityRange is less than zero.
68 Standard_EXPORT Geom2dConvert_BSplineCurveKnotSplitting(const Handle(Geom2d_BSplineCurve)& BasisCurve, const Standard_Integer ContinuityRange);
69
70 //! Returns the number of points at which the analysed
71 //! BSpline curve should be split, in order to obtain arcs
72 //! with the continuity required by this framework.
73 //! All these points correspond to knot values. Note that
74 //! the first and last points of the curve, which bound the
75 //! first and last arcs, are counted among these splitting points.
76 Standard_EXPORT Standard_Integer NbSplits() const;
77
78 //! Loads the SplitValues table with the split knots
79 //! values computed in this framework. Each value in the
80 //! table is an index in the knots table of the BSpline
81 //! curve analysed by this algorithm.
82 //! The values in SplitValues are given in ascending
83 //! order and comprise the indices of the knots which
84 //! give the first and last points of the curve. Use two
85 //! consecutive values from the table as arguments of the
86 //! global function SplitBSplineCurve (provided by the
87 //! package Geom2dConvert) to split the curve.
88 //! Exceptions
89 //! Standard_DimensionError if the array SplitValues
90 //! was not created with the following bounds:
91 //! - 1, and
92 //! - the number of split points computed in this
93 //! framework (as given by the function NbSplits).
94 Standard_EXPORT void Splitting (TColStd_Array1OfInteger& SplitValues) const;
95
96 //! Returns the split knot of index Index to the split knots
97 //! table computed in this framework. The returned value
98 //! is an index in the knots table of the BSpline curve
99 //! analysed by this algorithm.
100 //! Notes:
101 //! - If Index is equal to 1, the corresponding knot
102 //! gives the first point of the curve.
103 //! - If Index is equal to the number of split knots
104 //! computed in this framework, the corresponding
105 //! point is the last point of the curve.
106 //! Exceptions
107 //! Standard_RangeError if Index is less than 1 or
108 //! greater than the number of split knots computed in this framework.
109 Standard_EXPORT Standard_Integer SplitValue (const Standard_Integer Index) const;
110
111
112
113
114protected:
115
116
117
118
119
120private:
121
122
123
124 Handle(TColStd_HArray1OfInteger) splitIndexes;
125
126
127};
128
129
130
131
132
133
134
135#endif // _Geom2dConvert_BSplineCurveKnotSplitting_HeaderFile