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
32 #include "vtkPointSetAlgorithm.h"
33 
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkPoints;
36 class vtkDataArray;
37 
38 class VTKFILTERSCORE_EXPORT vtkCenterOfMass : public vtkPointSetAlgorithm
39 {
40 public:
41  static vtkCenterOfMass* New();
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 
72 protected:
74 
75  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
76  vtkInformationVector* outputVector) override;
77 
78 private:
79  vtkCenterOfMass(const vtkCenterOfMass&) = delete;
80  void operator=(const vtkCenterOfMass&) = delete;
81 
82  bool UseScalarsAsWeights;
83  double Center[3];
84 };
85 
86 VTK_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 vtkCenterOfMass * New()
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.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
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
@ center
Definition: vtkX3D.h:230