VTK  9.3.0
vtkCenterOfMass.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
28#ifndef vtkCenterOfMass_h
29#define vtkCenterOfMass_h
30
31#include "vtkFiltersCoreModule.h" // For export macro
33
34VTK_ABI_NAMESPACE_BEGIN
35class vtkPoints;
36class vtkDataArray;
37
38class VTKFILTERSCORE_EXPORT vtkCenterOfMass : public vtkPointSetAlgorithm
39{
40public:
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
46
49 vtkSetVector3Macro(Center, double);
50 vtkGetVector3Macro(Center, double);
52
54
57 vtkSetMacro(UseScalarsAsWeights, bool);
58 vtkGetMacro(UseScalarsAsWeights, bool);
60
70 static void ComputeCenterOfMass(vtkPoints* input, vtkDataArray* scalars, double center[3]);
71
72protected:
74
75 int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
76 vtkInformationVector* outputVector) override;
77
78private:
79 vtkCenterOfMass(const vtkCenterOfMass&) = delete;
80 void operator=(const vtkCenterOfMass&) = delete;
81
82 bool UseScalarsAsWeights;
83 double Center[3];
84};
85
86VTK_ABI_NAMESPACE_END
87#endif
Find the center of mass of a set of points.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
static void ComputeCenterOfMass(vtkPoints *input, vtkDataArray *scalars, double center[3])
This function is called by RequestData.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkCenterOfMass * New()
abstract superclass for arrays of numeric data
a simple class to control print indentation
Definition vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce output of the same type as input.
represent and manipulate 3D points
Definition vtkPoints.h:38