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
19#ifndef vtkCenterOfMass_h
20#define vtkCenterOfMass_h
21
22#include "vtkFiltersCoreModule.h" // For export macro
24
25VTK_ABI_NAMESPACE_BEGIN
26class vtkPoints;
27class vtkDataArray;
28
29class VTKFILTERSCORE_EXPORT vtkCenterOfMass : public vtkPointSetAlgorithm
30{
31public:
34 void PrintSelf(ostream& os, vtkIndent indent) override;
35
37
40 vtkSetVector3Macro(Center, double);
41 vtkGetVector3Macro(Center, double);
43
45
48 vtkSetMacro(UseScalarsAsWeights, bool);
49 vtkGetMacro(UseScalarsAsWeights, bool);
51
61 static void ComputeCenterOfMass(vtkPoints* input, vtkDataArray* scalars, double center[3]);
62
63protected:
65
66 int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
67 vtkInformationVector* outputVector) override;
68
69private:
70 vtkCenterOfMass(const vtkCenterOfMass&) = delete;
71 void operator=(const vtkCenterOfMass&) = delete;
72
73 bool UseScalarsAsWeights;
74 double Center[3];
75};
76
77VTK_ABI_NAMESPACE_END
78#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:29
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:29