VTK  9.5.20250905
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
44
45VTK_ABI_NAMESPACE_BEGIN
46class vtkPoints;
47class vtkDataArray;
48
49class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkCenterOfMass : public vtkPointSetAlgorithm
50{
51public:
54 void PrintSelf(ostream& os, vtkIndent indent) override;
55
57
60 vtkSetVector3Macro(Center, double);
61 vtkGetVector3Macro(Center, double);
63
65
68 vtkSetMacro(UseScalarsAsWeights, bool);
69 vtkGetMacro(UseScalarsAsWeights, bool);
71
81 static void ComputeCenterOfMass(vtkPoints* input, vtkDataArray* scalars, double center[3]);
82
83protected:
85
86 int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
87 vtkInformationVector* outputVector) override;
88
89private:
90 vtkCenterOfMass(const vtkCenterOfMass&) = delete;
91 void operator=(const vtkCenterOfMass&) = delete;
92
93 bool UseScalarsAsWeights;
94 double Center[3];
95};
96
97VTK_ABI_NAMESPACE_END
98#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
#define VTK_MARSHALAUTO