-
Notifications
You must be signed in to change notification settings - Fork 19
/
vtkParametricPolynomialApproximation.cxx
639 lines (557 loc) · 22.9 KB
/
vtkParametricPolynomialApproximation.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
/*==============================================================================
Program: 3D Slicer
Copyright (c) Kitware Inc.
See COPYRIGHT.txt
or http://www.slicer.org/copyright/copyright.txt for details.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This file was originally developed by Thomas Vaughan, PerkLab, Queen's University.
==============================================================================*/
#include "vtkParametricPolynomialApproximation.h"
#include <vtkDoubleArray.h>
#include <vtkMath.h>
#include <vtkObjectFactory.h>
#include <vtkPoints.h>
#include <vtkSmartPointer.h>
#include <vtkSortDataArray.h>
#include <vtkTimeStamp.h>
#include <vector>
#include <set>
vtkStandardNewMacro(vtkParametricPolynomialApproximation);
double EPSILON = 0.001;
//----------------------------------------------------------------------------
vtkParametricPolynomialApproximation::vtkParametricPolynomialApproximation()
{
this->MinimumU = 0;
this->MaximumU = 1.0;
this->JoinU = 0;
this->FitMethod = vtkParametricPolynomialApproximation::FIT_METHOD_GLOBAL_LEAST_SQUARES;
this->Points = nullptr;
this->Parameters = nullptr;
this->PolynomialOrder = 1;
this->SamplePosition = 0.0;
this->Weights = nullptr;
this->SortedParameters = nullptr;
this->WeightFunction = vtkParametricPolynomialApproximation::WEIGHT_FUNCTION_GAUSSIAN;
this->SampleWidth = 0.5;
this->SafeSampleWidth = 0.0; // recomputed as needed by this class
this->SafeHalfSampleWidthComputedTime.Modified();
this->Coefficients = nullptr;
}
//----------------------------------------------------------------------------
vtkParametricPolynomialApproximation::~vtkParametricPolynomialApproximation() = default;
//----------------------------------------------------------------------------
void vtkParametricPolynomialApproximation::SetPoints(vtkPoints* points)
{
this->Points = points;
this->Modified();
}
//----------------------------------------------------------------------------
void vtkParametricPolynomialApproximation::SetParameters(vtkDoubleArray* array)
{
this->Parameters = array;
this->Modified();
}
//----------------------------------------------------------------------------
void vtkParametricPolynomialApproximation::Evaluate(double u[3], double outputPoint[3], double*)
{
// Set default value
outputPoint[0] = outputPoint[1] = outputPoint[2] = 0;
this->SamplePosition = vtkMath::ClampValue< double >(u[0], 0.0, 1.0);
// make sure everything has been set up
if (this->ComputeCoefficientsNeeded())
{
this->ComputeCoefficients();
}
// error cases, just return
if (this->Coefficients == nullptr || this->Coefficients->GetNumberOfTuples() == 0)
{
vtkErrorMacro("Polynomial coefficients were not computed. Returning without evaluating.");
return;
}
const int numberOfDimensions = 3;
int numberOfCoefficients = this->Coefficients->GetNumberOfComponents();
for (int dimensionIndex = 0; dimensionIndex < numberOfDimensions; dimensionIndex++)
{
for (int coefficientIndex = 0; coefficientIndex < numberOfCoefficients; coefficientIndex++)
{
double coefficient = this->Coefficients->GetComponent(dimensionIndex, coefficientIndex);
double samplePositionToExponent = std::pow(this->SamplePosition, coefficientIndex);
outputPoint[dimensionIndex] += coefficient * samplePositionToExponent;
}
}
}
//----------------------------------------------------------------------------
double vtkParametricPolynomialApproximation::EvaluateScalar(double u[3], double*, double*)
{
return u[0];
}
//----------------------------------------------------------------------------
void vtkParametricPolynomialApproximation::ComputeCoefficients()
{
this->Coefficients = nullptr; // this indicates that the coefficients have not been computed (yet)
if (this->Points == nullptr || this->Points->GetNumberOfPoints() == 0)
{
vtkErrorMacro("Points are missing. Cannot compute coefficients.");
return;
}
if (this->Parameters == nullptr || this->Parameters->GetNumberOfTuples() == 0)
{
vtkErrorMacro("Parameters are missing. Cannot compute coefficients.");
return;
}
int numberOfPoints = this->Points->GetNumberOfPoints();
int numberOfParameters = this->Parameters->GetNumberOfTuples();
if (numberOfPoints != numberOfParameters)
{
vtkErrorMacro("Need equal number of parameters and points. Got "
<< numberOfParameters << " and " << numberOfPoints << ", respectively. Cannot compute coefficients.");
return;
}
if (this->ComputeWeightsNeeded())
{
this->ComputeWeights();
}
this->Coefficients = vtkSmartPointer< vtkDoubleArray >::New();
this->FitLeastSquaresPolynomials(this->Parameters, this->Points, this->Weights, this->PolynomialOrder, this->Coefficients);
}
//------------------------------------------------------------------------------
bool vtkParametricPolynomialApproximation::ComputeCoefficientsNeeded()
{
// Assume that if anything is null, then the user intends for everything to be computed.
// In normal use, none of these should be null
if (this->Coefficients == nullptr || this->Points == nullptr || this->Parameters == nullptr)
{
return true;
}
// In moving least squares the weights (and hence coefficients) change
// depending on the sample position, so this should always be recomputed
if (this->FitMethod == vtkParametricPolynomialApproximation::FIT_METHOD_MOVING_LEAST_SQUARES)
{
return true;
}
vtkMTimeType coefficientsModifiedTime = this->Coefficients->GetMTime();
vtkMTimeType approximatorModifiedTime = this->GetMTime();
if (approximatorModifiedTime > coefficientsModifiedTime)
{
return true;
}
vtkMTimeType pointsModifiedTime = this->Points->GetMTime();
if (pointsModifiedTime > coefficientsModifiedTime)
{
return true;
}
vtkMTimeType parametersModifiedTime = this->Parameters->GetMTime();
if (parametersModifiedTime > coefficientsModifiedTime)
{
return true;
}
// If weights are made modifiable by the user, they will need to be checked here too
return false;
}
//------------------------------------------------------------------------------
void vtkParametricPolynomialApproximation::ComputeWeights()
{
if (this->Parameters == nullptr)
{
vtkErrorMacro("Parameters are null. cannot compute weights.");
return;
}
if (this->Weights == nullptr)
{
this->Weights = vtkSmartPointer< vtkDoubleArray >::New();
}
else
{
this->Weights->Reset();
}
if (this->FitMethod == vtkParametricPolynomialApproximation::FIT_METHOD_GLOBAL_LEAST_SQUARES)
{
this->ComputeWeightsGlobalLeastSquares();
}
else if (this->FitMethod == vtkParametricPolynomialApproximation::FIT_METHOD_MOVING_LEAST_SQUARES)
{
this->ComputeWeightsMovingLeastSquares();
}
else
{
vtkErrorMacro("Unexpected FitMethod case in ComputeWeights: " << this->FitMethod << ". Cannot compute weights.");
}
}
//------------------------------------------------------------------------------
void vtkParametricPolynomialApproximation::ComputeWeightsGlobalLeastSquares()
{
int numberOfParameters = this->Parameters->GetNumberOfTuples();
for (int parameterIndex = 0; parameterIndex < numberOfParameters; parameterIndex++)
{
this->Weights->InsertNextTuple1(1.0);
}
}
//------------------------------------------------------------------------------
void vtkParametricPolynomialApproximation::ComputeWeightsMovingLeastSquares()
{
if (this->ComputeSafeSampleWidthNeeded())
{
this->ComputeSafeSampleWidth();
}
double samplePosition = this->SamplePosition;
double halfSampleWidth = this->SafeSampleWidth / 2.0;
double maximumDistanceFromSamplePosition = halfSampleWidth + EPSILON;
int numberOfParameters = this->Parameters->GetNumberOfTuples();
for (int parameterIndex = 0; parameterIndex < numberOfParameters; parameterIndex++)
{
double weight = 0.0; // assume this value until we know parameterValue (next line) is in range
double parameterValue = this->Parameters->GetValue(parameterIndex);
double parameterDistanceFromSamplePosition = abs(parameterValue - samplePosition);
if (parameterDistanceFromSamplePosition <= maximumDistanceFromSamplePosition)
{
switch (this->WeightFunction)
{
case vtkParametricPolynomialApproximation::WEIGHT_FUNCTION_RECTANGULAR:
{
weight = 1.0;
break;
}
case vtkParametricPolynomialApproximation::WEIGHT_FUNCTION_TRIANGULAR:
{
weight = 1.0 - (parameterDistanceFromSamplePosition / halfSampleWidth);
break;
}
case vtkParametricPolynomialApproximation::WEIGHT_FUNCTION_COSINE:
{
// map between -PI and PI
double distanceNormalizedRadians = (parameterDistanceFromSamplePosition / halfSampleWidth) * vtkMath::Pi();
double cosine = std::cos(distanceNormalizedRadians);
// remap from -1..1 to 0..1
weight = cosine / 2.0 + 0.5;
break;
}
case vtkParametricPolynomialApproximation::WEIGHT_FUNCTION_GAUSSIAN:
{
// halfSampleWidth represents 3 standard deviations, so 99.7% of the gaussian will be captured
double stdev = halfSampleWidth / 3.0;
double variance = stdev * stdev;
weight = vtkMath::GaussianAmplitude(variance, parameterDistanceFromSamplePosition);
break;
}
default:
{
vtkErrorMacro("Unexpected weight function: " << this->WeightFunction << ". Cannot compute weights.");
return;
}
}
}
this->Weights->InsertNextTuple1(weight);
}
}
//------------------------------------------------------------------------------
bool vtkParametricPolynomialApproximation::ComputeWeightsNeeded()
{
// Assume that if anything is null, then the user intends for everything to be computed.
// In normal use, none of these should be null
if (this->Weights == nullptr || this->Parameters == nullptr)
{
return true;
}
if (this->FitMethod == vtkParametricPolynomialApproximation::FIT_METHOD_MOVING_LEAST_SQUARES)
{
return true;
}
vtkMTimeType approximatorModifiedTime = this->GetMTime();
vtkMTimeType weightsModifiedTime = this->Weights->GetMTime();
if (approximatorModifiedTime > weightsModifiedTime)
{
return true;
}
vtkMTimeType parametersModifiedTime = this->Parameters->GetMTime();
if (parametersModifiedTime > weightsModifiedTime)
{
return true;
}
return false;
}
//------------------------------------------------------------------------------
void vtkParametricPolynomialApproximation::ComputeSortedParameters()
{
if (this->Parameters == nullptr)
{
vtkErrorMacro("Cannot compute sorted parameters. Parameters are null.");
return;
}
if (this->SortedParameters == nullptr)
{
this->SortedParameters = vtkSmartPointer< vtkDoubleArray >::New();
}
else
{
this->SortedParameters->Reset();
}
this->SortedParameters->DeepCopy(this->Parameters);
vtkSortDataArray::Sort(this->SortedParameters);
}
//------------------------------------------------------------------------------
bool vtkParametricPolynomialApproximation::ComputeSortedParametersNeeded()
{
// Assume that if anything is null, then the user intends for everything to be computed.
// In normal use, none of these should be null
if (this->SortedParameters == nullptr || this->Parameters == nullptr)
{
return true;
}
vtkMTimeType sortedModifiedTime = this->SortedParameters->GetMTime();
vtkMTimeType originalModifiedTime = this->Parameters->GetMTime();
if (originalModifiedTime > sortedModifiedTime)
{
return true;
}
return false;
}
//------------------------------------------------------------------------------
// Check to make sure that there are no gaps between parameters larger than sampleWidth,
// otherwise there is a risk of fitting a polynomial with no underlying data (which is bad)
void vtkParametricPolynomialApproximation::ComputeSafeSampleWidth()
{
if (this->ComputeSortedParametersNeeded())
{
this->ComputeSortedParameters();
}
if (this->SortedParameters == nullptr || this->SortedParameters->GetNumberOfTuples() == 0)
{
vtkErrorMacro("Sorted parameters are null. " <<
"Cannot compute \"safe\" sample width, will use user-requested sample width " << this->SampleWidth << ".");
this->SafeSampleWidth = this->SampleWidth;
return;
}
int numberOfParameters = this->Parameters->GetNumberOfTuples();
int numberOfSortedParameters = this->SortedParameters->GetNumberOfTuples();
if (numberOfSortedParameters != numberOfParameters)
{
vtkErrorMacro("Number of parameters before sorting " << numberOfParameters <<
" is not the same as after " << numberOfSortedParameters << ". " <<
"Cannot compute \"safe\" sample width, will use user-requested sample width " << this->SampleWidth << ".");
this->SafeSampleWidth = this->SampleWidth;
return;
}
double safeSampleWidth = this->SampleWidth;
for (int parameterIndex = 0; parameterIndex < numberOfParameters - 1; parameterIndex++)
{
double firstParameter = this->SortedParameters->GetValue(parameterIndex);
double secondParameter = this->SortedParameters->GetValue(parameterIndex + 1);
double widthBetweenParameters = std::abs(secondParameter - firstParameter);
if (safeSampleWidth < widthBetweenParameters)
{
safeSampleWidth = widthBetweenParameters + EPSILON;
}
}
this->SafeSampleWidth = safeSampleWidth;
this->SafeHalfSampleWidthComputedTime.Modified();
if (this->SampleWidth != this->SafeSampleWidth)
{
vtkWarningMacro("Requested sample width " << this->SampleWidth << " is too small and will result in singularities. " <<
"Computations will use the smallest \"safe\" value " << this->SafeSampleWidth << " instead.");
}
}
//------------------------------------------------------------------------------
bool vtkParametricPolynomialApproximation::ComputeSafeSampleWidthNeeded()
{
// Assume that if parameters are null, then the user intends for everything to be computed.
// In normal use, none of these should be null
if (this->Parameters == nullptr)
{
return true;
}
vtkMTimeType safeSampleModifiedTime = this->SafeHalfSampleWidthComputedTime.GetMTime();
vtkMTimeType parametersModifiedTime = this->Parameters->GetMTime();
if (safeSampleModifiedTime < parametersModifiedTime)
{
return true;
}
vtkMTimeType approximatorModifiedTime = this->GetMTime(); // last change by user
if (safeSampleModifiedTime < approximatorModifiedTime)
{
return true;
}
return false;
}
//------------------------------------------------------------------------------
// This function formats the data so it works with vtkMath::SolveLeastSquares.
void vtkParametricPolynomialApproximation::FitLeastSquaresPolynomials(
vtkDoubleArray* parameters, vtkPoints* points, vtkDoubleArray* weights, int polynomialOrder, vtkDoubleArray* coefficients)
{
// error checking
if (parameters == nullptr)
{
vtkGenericWarningMacro("Parameters are null. Aborting least squares fit.");
return;
}
if (points == nullptr)
{
vtkGenericWarningMacro("Points are null. Aborting least squares fit.");
return;
}
if (weights == nullptr)
{
vtkGenericWarningMacro("Weights are null. Aborting least squares fit.");
return;
}
int numberOfPoints = points->GetNumberOfPoints();
int numberOfParameters = parameters->GetNumberOfTuples();
if (numberOfPoints != numberOfParameters)
{
vtkGenericWarningMacro("The number of points " << numberOfPoints << " does not match number of parameters "
<< numberOfParameters << ". Aborting least squares fit.");
return;
}
int numberOfWeights = weights->GetNumberOfTuples();
if (numberOfPoints != numberOfWeights)
{
vtkGenericWarningMacro("The number of points " << numberOfPoints << " does not match number of weights "
<< numberOfWeights << ". Aborting least squares fit.");
return;
}
// The system of equations using high-order polynomials is not well-conditioned.
// The vtkMath implementation will usually abort with polynomial orders higher than 9.
// Since there is also numerical instability, we decide to limit the polynomial order to 6.
// If order higher than 6 is needed on a global fit, then another algorithm should be considered anyway.
// If at some point we want to add support for higher order polynomials, then here are two options (from Andras):
// 1. VNL. While the VNL code is more sophisticated, and I guess also more stable, you would probably need to
// limit the number of samples and normalize data that you pass to the LSQR solver to be able to compute
// higher-order fits (see for example this page for related discussion:
// https://digital.ni.com/public.nsf/allkb/45C2016C23B3B0298525645F0073B828).
// See an example how VNL is used in Plus:
// https://github.com/PlusToolkit/PlusLib/blob/master/src/PlusCommon/PlusMath.cxx#L111
// 2. Mathematica uses different basis functions for polynomial fitting (shifted Chebyshev polynomials) instead
// of basis functions that are simple powers of a variable to make the fitting more robust (the source code
// is available here: https://library.wolfram.com/infocenter/MathSource/6780/).
const int maximumPolynomialOrder = 6;
if (polynomialOrder > maximumPolynomialOrder)
{
vtkGenericWarningMacro("Desired polynomial order " << polynomialOrder << " is not supported. "
<< "Maximum supported order is " << maximumPolynomialOrder << ". "
<< "Will attempt to create polynomial order " << maximumPolynomialOrder << " instead.");
polynomialOrder = maximumPolynomialOrder;
}
const int minimumPolynomialOrder = 0; // It's a pretty weird input, but it does work. Just creates an average.
if (polynomialOrder < minimumPolynomialOrder)
{
vtkGenericWarningMacro("Desired polynomial order " << polynomialOrder << " is not supported. "
<< "Minimum supported order is " << minimumPolynomialOrder << ". "
<< "Will attempt to create constant average instead.");
polynomialOrder = minimumPolynomialOrder;
}
// determine number of coefficients for this polynomial
std::set< double > uniqueParameters;
for (int pointIndex = 0; pointIndex < numberOfPoints; pointIndex++)
{
double weight = weights->GetValue(pointIndex);
if (weight > EPSILON)
{
double parameterValue = parameters->GetValue(pointIndex);
uniqueParameters.insert(parameterValue); // set cannot contain duplicates
}
}
int numberOfUniqueParameters = uniqueParameters.size();
int numberOfCoefficients = polynomialOrder + 1;
if (numberOfUniqueParameters < numberOfCoefficients)
{
// must reduce the order of polynomial according to the amount of information is available
numberOfCoefficients = numberOfUniqueParameters;
}
// independent values (parameter along the curve)
int numIndependentValues = numberOfPoints * numberOfCoefficients;
std::vector< double > independentValues(numIndependentValues, 0.0);
for (int coefficientIndex = 0; coefficientIndex < numberOfCoefficients; coefficientIndex++)
{
for (int pointIndex = 0; pointIndex < numberOfPoints; pointIndex++)
{
double parameterValue = parameters->GetValue(pointIndex);
double weight = weights->GetValue(pointIndex);
double independentValue = std::pow(parameterValue, coefficientIndex) * weight;
independentValues[pointIndex * numberOfCoefficients + coefficientIndex] = independentValue;
}
}
std::vector< double* > independentMatrix(numberOfPoints, nullptr);
for (int pointIndex = 0; pointIndex < numberOfPoints; pointIndex++)
{
independentMatrix[pointIndex] = &(independentValues[pointIndex * numberOfCoefficients]);
}
double** independentMatrixPtr = &(independentMatrix[0]);
// dependent values
const int numberOfDimensions = 3;
int numDependentValues = numberOfPoints * numberOfDimensions;
std::vector< double > dependentValues(numDependentValues, 0.0);
for (int pointIndex = 0; pointIndex < numberOfPoints; pointIndex++)
{
double* currentPoint = points->GetPoint(pointIndex);
double weight = weights->GetValue(pointIndex);
for (int dimensionIndex = 0; dimensionIndex < numberOfDimensions; dimensionIndex++)
{
double value = currentPoint[dimensionIndex] * weight;
dependentValues[pointIndex * numberOfDimensions + dimensionIndex] = value;
}
}
std::vector< double* > dependentMatrix(numberOfPoints, nullptr);
for (int pointIndex = 0; pointIndex < numberOfPoints; pointIndex++)
{
dependentMatrix[pointIndex] = &(dependentValues[pointIndex * numberOfDimensions]);
}
double** dependentMatrixPtr = &(dependentMatrix[0]);
// solution to least squares
std::vector< double > coefficientValues(numberOfDimensions * numberOfCoefficients, 0.0);
std::vector< double* > coefficientMatrix(numberOfCoefficients, nullptr);
for (int coefficientIndex = 0; coefficientIndex < numberOfCoefficients; coefficientIndex++)
{
coefficientMatrix[coefficientIndex] = &(coefficientValues[coefficientIndex * numberOfDimensions]);
}
double** coefficientMatrixPtr = &(coefficientMatrix[0]); // the solution
// Input the forumulation into vtkMath::SolveLeastSquares
vtkMath::SolveLeastSquares(numberOfPoints, independentMatrixPtr, numberOfCoefficients, dependentMatrixPtr, numberOfDimensions, coefficientMatrixPtr);
// Store result in the appropriate variable
coefficients->Reset();
coefficients->SetNumberOfComponents(numberOfCoefficients); // must be set before number of tuples
coefficients->SetNumberOfTuples(numberOfDimensions);
for (int dimensionIndex = 0; dimensionIndex < numberOfDimensions; dimensionIndex++)
{
for (int coefficientIndex = 0; coefficientIndex < numberOfCoefficients; coefficientIndex++)
{
double coefficient = coefficientValues[coefficientIndex * numberOfDimensions + dimensionIndex];
coefficients->SetComponent(dimensionIndex, coefficientIndex, coefficient);
}
}
}
//----------------------------------------------------------------------------
void vtkParametricPolynomialApproximation::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "Parameters: ";
if (this->Parameters != nullptr)
{
os << this->Parameters << "\n";
}
else
{
os << "(none)\n";
}
os << indent << "Points: ";
if (this->Points != nullptr)
{
os << this->Points << "\n";
}
else
{
os << "(none)\n";
}
os << indent << this->PolynomialOrder << "\n";
os << indent << "Coefficients: ";
if (this->Coefficients != nullptr)
{
os << this->Coefficients << "\n";
}
else
{
os << "(none)\n";
}
}