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 class vtkPoints;
38 
40 {
41 public:
42 //BTX
43  static vtkPoints *New(int dataType);
44 //ETX
45  static vtkPoints *New();
46 
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
51  virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000);
52 
54  virtual void Initialize();
55 
57 
63  virtual void SetData(vtkDataArray *);
64  vtkDataArray *GetData() {return this->Data;};
66 
69  virtual int GetDataType();
70 
72 
73  virtual void SetDataType(int dataType);
74  void SetDataTypeToBit() {this->SetDataType(VTK_BIT);};
75  void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);};
76  void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);};
77  void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);};
78  void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);};
79  void SetDataTypeToInt() {this->SetDataType(VTK_INT);};
80  void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);};
81  void SetDataTypeToLong() {this->SetDataType(VTK_LONG);};
82  void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);};
83  void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);};
84  void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);};
86 
89  void *GetVoidPointer(const int id) {return this->Data->GetVoidPointer(id);};
90 
92  virtual void Squeeze() {this->Data->Squeeze();};
93 
95  virtual void Reset() {this->Data->Reset();};
96 
98 
101  virtual void DeepCopy(vtkPoints *ad);
102  virtual void ShallowCopy(vtkPoints *ad);
104 
111  unsigned long GetActualMemorySize();
112 
114  vtkIdType GetNumberOfPoints() { return this->Data->GetNumberOfTuples();};
115 
120  double *GetPoint(vtkIdType id) { return this->Data->GetTuple(id);};
121 
123  void GetPoint(vtkIdType id, double x[3]) { this->Data->GetTuple(id,x);};
124 
126 
129  void SetPoint(vtkIdType id, const float x[3]) { this->Data->SetTuple(id,x);};
130  void SetPoint(vtkIdType id, const double x[3]) { this->Data->SetTuple(id,x);};
131  void SetPoint(vtkIdType id, double x, double y, double z);
133 
135 
137  void InsertPoint(vtkIdType id, const float x[3])
138  { this->Data->InsertTuple(id,x);};
139  void InsertPoint(vtkIdType id, const double x[3])
140  {this->Data->InsertTuple(id,x);};
141  void InsertPoint(vtkIdType id, double x, double y, double z);
143 
145 
146  vtkIdType InsertNextPoint(const float x[3]) {
147  return this->Data->InsertNextTuple(x);};
148  vtkIdType InsertNextPoint(const double x[3]) {
149  return this->Data->InsertNextTuple(x);};
150  vtkIdType InsertNextPoint(double x, double y, double z);
152 
156  void SetNumberOfPoints(vtkIdType number);
157 
160  int Resize(vtkIdType numPoints);
161 
163  void GetPoints(vtkIdList *ptId, vtkPoints *fp);
164 
166  virtual void ComputeBounds();
167 
169  double *GetBounds();
170 
172  void GetBounds(double bounds[6]);
173 
174 protected:
175  vtkPoints(int dataType=VTK_FLOAT);
176  ~vtkPoints();
177 
178  double Bounds[6];
179  vtkTimeStamp ComputeTime; // Time at which bounds computed
180  vtkDataArray *Data; // Array which represents data
181 
182 private:
183  vtkPoints(const vtkPoints&); // Not implemented.
184  void operator=(const vtkPoints&); // Not implemented.
185 };
186 
188 {
189  this->Data->SetNumberOfComponents(3);
190  this->Data->SetNumberOfTuples(number);
191 }
192 
193 inline int vtkPoints::Resize(vtkIdType numPoints)
194 {
195  this->Data->SetNumberOfComponents(3);
196  return this->Data->Resize(numPoints);
197 }
198 
199 inline void vtkPoints::SetPoint(vtkIdType id, double x, double y, double z)
200 {
201  double p[3];
202  p[0] = x;
203  p[1] = y;
204  p[2] = z;
205  this->Data->SetTuple(id,p);
206 }
207 
208 inline void vtkPoints::InsertPoint(vtkIdType id, double x, double y, double z)
209 {
210  double p[3];
211 
212  p[0] = x;
213  p[1] = y;
214  p[2] = z;
215  this->Data->InsertTuple(id,p);
216 }
217 
218 inline vtkIdType vtkPoints::InsertNextPoint(double x, double y, double z)
219 {
220  double p[3];
221 
222  p[0] = x;
223  p[1] = y;
224  p[2] = z;
225  return this->Data->InsertNextTuple(p);
226 }
227 
228 #endif
229 
void SetDataTypeToInt()
Definition: vtkPoints.h:79
void SetDataTypeToFloat()
Definition: vtkPoints.h:83
void SetDataTypeToUnsignedChar()
Definition: vtkPoints.h:76
int Resize(vtkIdType numPoints)
Definition: vtkPoints.h:193
void GetPoint(vtkIdType id, double x[3])
Definition: vtkPoints.h:123
#define VTK_UNSIGNED_INT
Definition: vtkType.h:32
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkIdType InsertNextPoint(const double x[3])
Definition: vtkPoints.h:148
vtkIdType GetNumberOfPoints()
Definition: vtkPoints.h:114
void SetPoint(vtkIdType id, const double x[3])
Definition: vtkPoints.h:130
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:30
#define VTKCOMMONCORE_EXPORT
void SetDataTypeToLong()
Definition: vtkPoints.h:81
record modification and/or execution time
Definition: vtkTimeStamp.h:34
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
vtkIdType InsertNextPoint(const float x[3])
Definition: vtkPoints.h:146
void SetPoint(vtkIdType id, const float x[3])
Definition: vtkPoints.h:129
virtual void SetNumberOfTuples(vtkIdType number)=0
void SetNumberOfPoints(vtkIdType number)
Definition: vtkPoints.h:187
vtkDataArray * Data
Definition: vtkPoints.h:180
int vtkIdType
Definition: vtkType.h:268
void SetDataTypeToUnsignedInt()
Definition: vtkPoints.h:80
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
void SetDataTypeToChar()
Definition: vtkPoints.h:75
GLdouble GLdouble z
Definition: vtkgl.h:11754
#define VTK_DOUBLE
Definition: vtkType.h:36
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
virtual void Reset()
Definition: vtkPoints.h:95
virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
#define VTK_FLOAT
Definition: vtkType.h:35
void InsertPoint(vtkIdType id, const float x[3])
Definition: vtkPoints.h:137
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
void * GetVoidPointer(const int id)
Definition: vtkPoints.h:89
list of point or cell ids
Definition: vtkIdList.h:35
virtual int Resize(vtkIdType numTuples)=0
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
#define VTK_SHORT
Definition: vtkType.h:29
void SetDataTypeToUnsignedLong()
Definition: vtkPoints.h:82
#define VTK_CHAR
Definition: vtkType.h:26
#define VTK_LONG
Definition: vtkType.h:33
double * GetPoint(vtkIdType id)
Definition: vtkPoints.h:120
vtkTimeStamp ComputeTime
Definition: vtkPoints.h:179
virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
virtual void SetNumberOfComponents(int)
void SetDataTypeToBit()
Definition: vtkPoints.h:74
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:28
void SetDataTypeToShort()
Definition: vtkPoints.h:77
#define VTK_BIT
Definition: vtkType.h:25
void SetDataTypeToUnsignedShort()
Definition: vtkPoints.h:78
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:34
vtkDataArray * GetData()
Definition: vtkPoints.h:64
static vtkObject * New()
virtual void Squeeze()
Definition: vtkPoints.h:92
void SetDataTypeToDouble()
Definition: vtkPoints.h:84
virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source)=0
void InsertPoint(vtkIdType id, const double x[3])
Definition: vtkPoints.h:139
#define VTK_INT
Definition: vtkType.h:31
represent and manipulate 3D points
Definition: vtkPoints.h:39
GLfloat GLfloat p
Definition: vtkgl.h:15717