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