VTK  9.7.1
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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkPoints;
28 class vtkDataArray;
29 
30 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkCenterOfMass : public vtkPointSetAlgorithm
31 {
32 public:
33  static vtkCenterOfMass* New();
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
38 
41  vtkSetVector3Macro(Center, double);
42  vtkGetVector3Macro(Center, double);
44 
46 
49  vtkSetMacro(UseScalarsAsWeights, bool);
50  vtkGetMacro(UseScalarsAsWeights, bool);
52 
62  static void ComputeCenterOfMass(vtkPoints* input, vtkDataArray* scalars, double center[3]);
63 
64 protected:
66 
67  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
68  vtkInformationVector* outputVector) override;
69 
70 private:
71  vtkCenterOfMass(const vtkCenterOfMass&) = delete;
72  void operator=(const vtkCenterOfMass&) = delete;
73 
74  bool UseScalarsAsWeights;
75  double Center[3];
76 };
77 
78 VTK_ABI_NAMESPACE_END
79 #endif
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Store vtkAlgorithm input/output information.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instantiation, obtaining type information, and printing instances of the class...
Find the center of mass of a set of points.
a simple class to control print indentation
Definition: vtkIndent.h:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
Superclass for algorithms that process vtkPointSet input.
static vtkPointSetAlgorithm * New()
Standard methods for instantiation, obtaining type information, and printing instances of the class...
Store zero or more vtkInformation instances.
#define VTK_MARSHALAUTO
represent and manipulate 3D points
Definition: vtkPoints.h:30