VTK  9.4.20241217
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
38#ifndef vtkCenterOfMass_h
39#define vtkCenterOfMass_h
40
41#include "vtkFiltersCoreModule.h" // For export macro
43
44VTK_ABI_NAMESPACE_BEGIN
45class vtkPoints;
46class vtkDataArray;
47
48class VTKFILTERSCORE_EXPORT vtkCenterOfMass : public vtkPointSetAlgorithm
49{
50public:
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
56
59 vtkSetVector3Macro(Center, double);
60 vtkGetVector3Macro(Center, double);
62
64
67 vtkSetMacro(UseScalarsAsWeights, bool);
68 vtkGetMacro(UseScalarsAsWeights, bool);
70
80 static void ComputeCenterOfMass(vtkPoints* input, vtkDataArray* scalars, double center[3]);
81
82protected:
84
85 int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
86 vtkInformationVector* outputVector) override;
87
88private:
89 vtkCenterOfMass(const vtkCenterOfMass&) = delete;
90 void operator=(const vtkCenterOfMass&) = delete;
91
92 bool UseScalarsAsWeights;
93 double Center[3];
94};
95
96VTK_ABI_NAMESPACE_END
97#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:108
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:139