VTK
vtkPoints.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPoints.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 vtkPoints_h
29 #define vtkPoints_h
30 
31 #include "vtkCommonCoreModule.h" // For export macro
32 #include "vtkObject.h"
33 
34 #include "vtkDataArray.h" // Needed for inline methods
35 
36 class vtkIdList;
37 
39 {
40 public:
41 //BTX
42  static vtkPoints *New(int dataType);
43 //ETX
44  static vtkPoints *New();
45 
47  void PrintSelf(ostream& os, vtkIndent indent);
48 
50  virtual int Allocate(const vtkIdType sz, const vtkIdType ext = 1000);
51 
53  virtual void Initialize();
54 
56 
62  virtual void SetData(vtkDataArray *);
63  vtkDataArray *GetData() { return this->Data; }
65 
68  virtual int GetDataType();
69 
71 
72  virtual void SetDataType(int dataType);
73  void SetDataTypeToBit() { this->SetDataType(VTK_BIT); }
74  void SetDataTypeToChar() { this->SetDataType(VTK_CHAR); }
75  void SetDataTypeToUnsignedChar() { this->SetDataType(VTK_UNSIGNED_CHAR); }
76  void SetDataTypeToShort() { this->SetDataType(VTK_SHORT); }
77  void SetDataTypeToUnsignedShort() { this->SetDataType(VTK_UNSIGNED_SHORT); }
78  void SetDataTypeToInt() { this->SetDataType(VTK_INT); }
79  void SetDataTypeToUnsignedInt() { this->SetDataType(VTK_UNSIGNED_INT); }
80  void SetDataTypeToLong() { this->SetDataType(VTK_LONG); }
81  void SetDataTypeToUnsignedLong() { this->SetDataType(VTK_UNSIGNED_LONG); }
82  void SetDataTypeToFloat() { this->SetDataType(VTK_FLOAT); }
83  void SetDataTypeToDouble() { this->SetDataType(VTK_DOUBLE); }
85 
88  void *GetVoidPointer(const int id) { return this->Data->GetVoidPointer(id); }
89 
91  virtual void Squeeze() { this->Data->Squeeze(); }
92 
94  virtual void Reset();
95 
97 
100  virtual void DeepCopy(vtkPoints *ad);
101  virtual void ShallowCopy(vtkPoints *ad);
103 
110  unsigned long GetActualMemorySize();
111 
113  vtkIdType GetNumberOfPoints() { return this->Data->GetNumberOfTuples(); }
114 
119  double *GetPoint(vtkIdType id) { return this->Data->GetTuple(id); }
120 
122  void GetPoint(vtkIdType id, double x[3]) { this->Data->GetTuple(id,x); }
123 
125 
128  void SetPoint(vtkIdType id, const float x[3]) { this->Data->SetTuple(id,x); }
129  void SetPoint(vtkIdType id, const double x[3]) { this->Data->SetTuple(id,x); }
130  void SetPoint(vtkIdType id, double x, double y, double z);
132 
134 
136  void InsertPoint(vtkIdType id, const float x[3])
137  { this->Data->InsertTuple(id,x);};
138  void InsertPoint(vtkIdType id, const double x[3])
139  {this->Data->InsertTuple(id,x);};
140  void InsertPoint(vtkIdType id, double x, double y, double z);
142 
144 
148  { this->Data->InsertTuples(dstIds, srcIds, source->Data); }
150 
152 
155  void InsertPoints(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart,
156  vtkPoints* source)
157  { this->Data->InsertTuples(dstStart, n, srcStart, source->Data); }
159 
161 
162  vtkIdType InsertNextPoint(const float x[3])
163  { return this->Data->InsertNextTuple(x); }
164  vtkIdType InsertNextPoint(const double x[3])
165  { return this->Data->InsertNextTuple(x); }
166  vtkIdType InsertNextPoint(double x, double y, double z);
168 
172  void SetNumberOfPoints(vtkIdType numPoints);
173 
176  int Resize(vtkIdType numPoints);
177 
179  void GetPoints(vtkIdList *ptId, vtkPoints *fp);
180 
182  virtual void ComputeBounds();
183 
185  double *GetBounds();
186 
188  void GetBounds(double bounds[6]);
189 
191  unsigned long int GetMTime();
192 
193 protected:
194  vtkPoints(int dataType = VTK_FLOAT);
196 
197  double Bounds[6];
198  vtkTimeStamp ComputeTime; // Time at which bounds computed
199  vtkDataArray *Data; // Array which represents data
200 
201 private:
202  vtkPoints(const vtkPoints&); // Not implemented.
203  void operator=(const vtkPoints&); // Not implemented.
204 };
205 
206 inline void vtkPoints::Reset()
207 {
208  this->Data->Reset();
209  this->Modified();
210 }
211 
213 {
214  this->Data->SetNumberOfComponents(3);
215  this->Data->SetNumberOfTuples(numPoints);
216  this->Modified();
217 }
218 
219 inline int vtkPoints::Resize(vtkIdType numPoints)
220 {
221  this->Data->SetNumberOfComponents(3);
222  this->Modified();
223  return this->Data->Resize(numPoints);
224 }
225 
226 inline void vtkPoints::SetPoint(vtkIdType id, double x, double y, double z)
227 {
228  double p[3] = { x, y, z };
229  this->Data->SetTuple(id, p);
230 }
231 
232 inline void vtkPoints::InsertPoint(vtkIdType id, double x, double y, double z)
233 {
234  double p[3] = { x, y, z };
235  this->Data->InsertTuple(id, p);
236 }
237 
238 inline vtkIdType vtkPoints::InsertNextPoint(double x, double y, double z)
239 {
240  double p[3] = { x, y, z };
241  return this->Data->InsertNextTuple(p);
242 }
243 
244 #endif
245 
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkPoints::InsertNextPoint
vtkIdType InsertNextPoint(const float x[3])
Definition: vtkPoints.h:162
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkPoints::DeepCopy
virtual void DeepCopy(vtkPoints *ad)
VTKCOMMONCORE_EXPORT
#define VTKCOMMONCORE_EXPORT
Definition: vtkCommonCoreModule.h:15
vtkPoints::SetDataTypeToUnsignedShort
void SetDataTypeToUnsignedShort()
Definition: vtkPoints.h:77
vtkPoints::SetDataTypeToShort
void SetDataTypeToShort()
Definition: vtkPoints.h:76
vtkPoints::SetNumberOfPoints
void SetNumberOfPoints(vtkIdType numPoints)
Definition: vtkPoints.h:212
vtkAbstractArray::Resize
virtual int Resize(vtkIdType numTuples)=0
vtkPoints::Squeeze
virtual void Squeeze()
Definition: vtkPoints.h:91
vtkPoints::InsertPoint
void InsertPoint(vtkIdType id, const float x[3])
Definition: vtkPoints.h:136
vtkIdType
int vtkIdType
Definition: vtkType.h:275
VTK_UNSIGNED_INT
#define VTK_UNSIGNED_INT
Definition: vtkType.h:32
VTK_UNSIGNED_SHORT
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:30
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkPoints::InsertNextPoint
vtkIdType InsertNextPoint(const double x[3])
Definition: vtkPoints.h:164
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkObject::Modified
virtual void Modified()
vtkgl::n
GLclampd n
Definition: vtkgl.h:14370
vtkPoints::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkPoints::GetVoidPointer
void * GetVoidPointer(const int id)
Definition: vtkPoints.h:88
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkDataArray::InsertTuple
virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkPoints::Reset
virtual void Reset()
Definition: vtkPoints.h:206
vtkPoints::GetPoint
void GetPoint(vtkIdType id, double x[3])
Definition: vtkPoints.h:122
vtkPoints::GetMTime
unsigned long int GetMTime()
vtkPoints::InsertPoints
void InsertPoints(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkPoints *source)
Definition: vtkPoints.h:155
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:821
vtkPoints::Data
vtkDataArray * Data
Definition: vtkPoints.h:199
vtkPoints::GetNumberOfPoints
vtkIdType GetNumberOfPoints()
Definition: vtkPoints.h:113
vtkAbstractArray::SetNumberOfComponents
virtual void SetNumberOfComponents(int)
vtkPoints::SetDataTypeToUnsignedLong
void SetDataTypeToUnsignedLong()
Definition: vtkPoints.h:81
vtkPoints::GetActualMemorySize
unsigned long GetActualMemorySize()
vtkCommonCoreModule.h
vtkAbstractArray::Reset
void Reset()
Definition: vtkAbstractArray.h:228
vtkPoints::SetDataTypeToChar
void SetDataTypeToChar()
Definition: vtkPoints.h:74
vtkPoints::GetPoint
double * GetPoint(vtkIdType id)
Definition: vtkPoints.h:119
VTK_CHAR
#define VTK_CHAR
Definition: vtkType.h:26
vtkPoints::ComputeTime
vtkTimeStamp ComputeTime
Definition: vtkPoints.h:198
vtkPoints::ComputeBounds
virtual void ComputeBounds()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkPoints::GetData
vtkDataArray * GetData()
Definition: vtkPoints.h:63
vtkPoints::~vtkPoints
~vtkPoints()
vtkPoints::Allocate
virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000)
vtkPoints::SetDataTypeToInt
void SetDataTypeToInt()
Definition: vtkPoints.h:78
vtkPoints::New
static vtkPoints * New(int dataType)
VTK_FLOAT
#define VTK_FLOAT
Definition: vtkType.h:35
vtkPoints::SetDataTypeToUnsignedInt
void SetDataTypeToUnsignedInt()
Definition: vtkPoints.h:79
VTK_DOUBLE
#define VTK_DOUBLE
Definition: vtkType.h:36
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
VTK_UNSIGNED_CHAR
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:28
VTK_LONG
#define VTK_LONG
Definition: vtkType.h:33
vtkPoints::New
static vtkPoints * New()
vtkPoints::SetDataTypeToDouble
void SetDataTypeToDouble()
Definition: vtkPoints.h:83
vtkPoints::GetBounds
double * GetBounds()
vtkObject.h
VTK_UNSIGNED_LONG
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:34
vtkPoints::SetPoint
void SetPoint(vtkIdType id, const double x[3])
Definition: vtkPoints.h:129
vtkPoints::GetPoints
void GetPoints(vtkIdList *ptId, vtkPoints *fp)
vtkPoints::SetData
virtual void SetData(vtkDataArray *)
VTK_SHORT
#define VTK_SHORT
Definition: vtkType.h:29
vtkDataArray.h
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkDataArray::InsertNextTuple
virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source)=0
vtkPoints::SetDataTypeToLong
void SetDataTypeToLong()
Definition: vtkPoints.h:80
vtkPoints::SetDataTypeToFloat
void SetDataTypeToFloat()
Definition: vtkPoints.h:82
vtkPoints::ShallowCopy
virtual void ShallowCopy(vtkPoints *ad)
vtkDataArray::SetTuple
virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
vtkPoints::InsertPoint
void InsertPoint(vtkIdType id, const double x[3])
Definition: vtkPoints.h:138
vtkAbstractArray::SetNumberOfTuples
virtual void SetNumberOfTuples(vtkIdType number)=0
vtkPoints::vtkPoints
vtkPoints(int dataType=VTK_FLOAT)
vtkgl::p
GLfloat GLfloat p
Definition: vtkgl.h:15717
vtkPoints::Initialize
virtual void Initialize()
VTK_BIT
#define VTK_BIT
Definition: vtkType.h:25
vtkPoints::SetDataType
virtual void SetDataType(int dataType)
VTK_INT
#define VTK_INT
Definition: vtkType.h:31
vtkPoints::InsertPoints
void InsertPoints(vtkIdList *dstIds, vtkIdList *srcIds, vtkPoints *source)
Definition: vtkPoints.h:147
vtkPoints::GetDataType
virtual int GetDataType()
vtkPoints::SetDataTypeToUnsignedChar
void SetDataTypeToUnsignedChar()
Definition: vtkPoints.h:75
vtkPoints::Resize
int Resize(vtkIdType numPoints)
Definition: vtkPoints.h:219
vtkPoints::SetPoint
void SetPoint(vtkIdType id, const float x[3])
Definition: vtkPoints.h:128
vtkPoints::SetDataTypeToBit
void SetDataTypeToBit()
Definition: vtkPoints.h:73
vtkPoints::GetBounds
void GetBounds(double bounds[6])