VTK
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 =========================================================================*/
31 #ifndef vtkCenterOfMass_h
32 #define vtkCenterOfMass_h
33 
34 #include "vtkFiltersCoreModule.h" // For export macro
35 #include "vtkPointSetAlgorithm.h"
36 
37 class vtkPoints;
38 class vtkDataArray;
39 
40 class VTKFILTERSCORE_EXPORT vtkCenterOfMass : public vtkPointSetAlgorithm
41 {
42 public:
43  static vtkCenterOfMass *New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
51  vtkSetVector3Macro(Center,double);
52  vtkGetVector3Macro(Center,double);
54 
56 
59  vtkSetMacro(UseScalarsAsWeights, bool);
60  vtkGetMacro(UseScalarsAsWeights, bool);
62 
72  static void ComputeCenterOfMass(
73  vtkPoints* input, vtkDataArray *scalars, double center[3]);
74 
75 protected:
77 
78  int RequestData(vtkInformation* request,
79  vtkInformationVector** inputVector,
80  vtkInformationVector* outputVector ) override;
81 
82 private:
83 
84  vtkCenterOfMass(const vtkCenterOfMass&) = delete;
85  void operator=(const vtkCenterOfMass&) = delete;
86 
87  bool UseScalarsAsWeights;
88  double Center[3];
89 };
90 
91 #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
Methods invoked by print to print information about the object including superclasses.
Find the center of mass of a set of points.
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
Superclass for algorithms that produce output of the same type as input.
static vtkPointSetAlgorithm * New()
Store zero or more vtkInformation instances.
represent and manipulate 3D points
Definition: vtkPoints.h:39