VTK  9.2.5
vtkCenterOfMass.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCenterOfMass.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
50 #ifndef vtkCenterOfMass_h
51 #define vtkCenterOfMass_h
52 
53 #include "vtkFiltersCoreModule.h" // For export macro
54 #include "vtkPointSetAlgorithm.h"
55 
56 class vtkPoints;
57 class vtkDataArray;
58 
59 class VTKFILTERSCORE_EXPORT vtkCenterOfMass : public vtkPointSetAlgorithm
60 {
61 public:
62  static vtkCenterOfMass* New();
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
70  vtkSetVector3Macro(Center, double);
71  vtkGetVector3Macro(Center, double);
73 
75 
78  vtkSetMacro(UseScalarsAsWeights, bool);
79  vtkGetMacro(UseScalarsAsWeights, bool);
81 
91  static void ComputeCenterOfMass(vtkPoints* input, vtkDataArray* scalars, double center[3]);
92 
93 protected:
95 
96  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
97  vtkInformationVector* outputVector) override;
98 
99 private:
100  vtkCenterOfMass(const vtkCenterOfMass&) = delete;
101  void operator=(const vtkCenterOfMass&) = delete;
102 
103  bool UseScalarsAsWeights;
104  double Center[3];
105 };
106 
107 #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:165
a simple class to control print indentation
Definition: vtkIndent.h:119
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:149
@ center
Definition: vtkX3D.h:236