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
23 #include "vtkPointSetAlgorithm.h"
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkPoints;
27 class vtkDataArray;
28 
29 class VTKFILTERSCORE_EXPORT vtkCenterOfMass : public vtkPointSetAlgorithm
30 {
31 public:
32  static vtkCenterOfMass* New();
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 
63 protected:
65 
66  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
67  vtkInformationVector* outputVector) override;
68 
69 private:
70  vtkCenterOfMass(const vtkCenterOfMass&) = delete;
71  void operator=(const vtkCenterOfMass&) = delete;
72 
73  bool UseScalarsAsWeights;
74  double Center[3];
75 };
76 
77 VTK_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 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:45
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
@ center
Definition: vtkX3D.h:230