VTK  9.3.20240328
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
42 #include "vtkPointSetAlgorithm.h"
43 
44 VTK_ABI_NAMESPACE_BEGIN
45 class vtkPoints;
46 class vtkDataArray;
47 
48 class VTKFILTERSCORE_EXPORT vtkCenterOfMass : public vtkPointSetAlgorithm
49 {
50 public:
51  static vtkCenterOfMass* New();
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 
82 protected:
84 
85  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
86  vtkInformationVector* outputVector) override;
87 
88 private:
89  vtkCenterOfMass(const vtkCenterOfMass&) = delete;
90  void operator=(const vtkCenterOfMass&) = delete;
91 
92  bool UseScalarsAsWeights;
93  double Center[3];
94 };
95 
96 VTK_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 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:154
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:138
@ center
Definition: vtkX3D.h:230