VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
39 class VTKCOMMONCORE_EXPORT vtkPoints : public vtkObject
40 {
41 public:
42 //BTX
43  static vtkPoints *New(int dataType);
44 //ETX
45  static vtkPoints *New();
46 
47  vtkTypeMacro(vtkPoints,vtkObject);
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 
159  void GetPoints(vtkIdList *ptId, vtkPoints *fp);
160 
162  virtual void ComputeBounds();
163 
165  double *GetBounds();
166 
168  void GetBounds(double bounds[6]);
169 
170 protected:
171  vtkPoints(int dataType=VTK_FLOAT);
172  ~vtkPoints();
173 
174  double Bounds[6];
175  vtkTimeStamp ComputeTime; // Time at which bounds computed
176  vtkDataArray *Data; // Array which represents data
177 
178 private:
179  vtkPoints(const vtkPoints&); // Not implemented.
180  void operator=(const vtkPoints&); // Not implemented.
181 };
182 
184 {
185  this->Data->SetNumberOfComponents(3);
186  this->Data->SetNumberOfTuples(number);
187 }
188 
189 inline void vtkPoints::SetPoint(vtkIdType id, double x, double y, double z)
190 {
191  double p[3];
192  p[0] = x;
193  p[1] = y;
194  p[2] = z;
195  this->Data->SetTuple(id,p);
196 }
197 
198 inline void vtkPoints::InsertPoint(vtkIdType id, double x, double y, double z)
199 {
200  double p[3];
201 
202  p[0] = x;
203  p[1] = y;
204  p[2] = z;
205  this->Data->InsertTuple(id,p);
206 }
207 
208 inline vtkIdType vtkPoints::InsertNextPoint(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  return this->Data->InsertNextTuple(p);
216 }
217 
218 #endif
219 
void SetDataTypeToInt()
Definition: vtkPoints.h:79
void SetDataTypeToFloat()
Definition: vtkPoints.h:83
void SetDataTypeToUnsignedChar()
Definition: vtkPoints.h:76
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
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:183
vtkDataArray * Data
Definition: vtkPoints.h:176
int vtkIdType
Definition: vtkType.h:268
void SetDataTypeToUnsignedInt()
Definition: vtkPoints.h:80
void SetDataTypeToChar()
Definition: vtkPoints.h:75
#define VTK_DOUBLE
Definition: vtkType.h:36
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
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:175
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