Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

common/vtkPoints.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkPoints.h,v $
00005   Language:  C++
00006 
00007 
00008 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00009 All rights reserved.
00010 
00011 Redistribution and use in source and binary forms, with or without
00012 modification, are permitted provided that the following conditions are met:
00013 
00014  * Redistributions of source code must retain the above copyright notice,
00015    this list of conditions and the following disclaimer.
00016 
00017  * Redistributions in binary form must reproduce the above copyright notice,
00018    this list of conditions and the following disclaimer in the documentation
00019    and/or other materials provided with the distribution.
00020 
00021  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00022    of any contributors may be used to endorse or promote products derived
00023    from this software without specific prior written permission.
00024 
00025  * Modified source versions must be plainly marked as such, and must not be
00026    misrepresented as being the original software.
00027 
00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00031 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038 
00039 =========================================================================*/
00053 #ifndef __vtkPoints_h
00054 #define __vtkPoints_h
00055 
00056 #include "vtkAttributeData.h"
00057 
00058 class vtkIdList;
00059 class vtkPoints;
00060 
00061 class VTK_EXPORT vtkPoints : public vtkAttributeData
00062 {
00063 public:
00064 //BTX
00065   static vtkPoints *New(int dataType);
00066 //ETX
00067   static vtkPoints *New();
00068 
00069   vtkTypeMacro(vtkPoints,vtkAttributeData);
00070   void PrintSelf(ostream& os, vtkIndent indent);
00071 
00073   vtkAttributeData *MakeObject();
00074 
00076   int GetNumberOfPoints() { return this->Data->GetNumberOfTuples();};
00077 
00079   float *GetPoint(int id) { return this->Data->GetTuple(id);};
00080 
00082   void GetPoint(int id, float x[3]) { this->Data->GetTuple(id,x);};
00083   void GetPoint(int id, double x[3]) { this->Data->GetTuple(id,x);};
00084 
00088   void SetPoint(int id, const float x[3]) { this->Data->SetTuple(id,x);};
00089   void SetPoint(int id, const double x[3]) { this->Data->SetTuple(id,x);};
00090   void SetPoint(int id, double x, double y, double z);
00091 
00094   void InsertPoint(int id, const float x[3]) { this->Data->InsertTuple(id,x);};
00095   void InsertPoint(int id, const double x[3]) {this->Data->InsertTuple(id,x);};
00096   void InsertPoint(int id, double x, double y, double z);
00097   
00099   int InsertNextPoint(const float x[3]) { 
00100     return this->Data->InsertNextTuple(x);};
00101   int InsertNextPoint(const double x[3]) { 
00102     return this->Data->InsertNextTuple(x);};
00103   int InsertNextPoint(double x, double y, double z);
00104 
00108   void SetNumberOfPoints(int number);
00109 
00111   void GetPoints(vtkIdList *ptId, vtkPoints *fp);
00112 
00114   virtual void ComputeBounds();
00115 
00117   float *GetBounds();
00118 
00120   void GetBounds(float bounds[6]);
00121 
00122 #ifndef VTK_REMOVE_LEGACY_CODE
00123 
00124   void GetPoints(vtkIdList &ptId, vtkPoints &fp) 
00125     {VTK_LEGACY_METHOD(GetPoints,"3.2"); this->GetPoints(&ptId, &fp);}
00126 #endif
00127   
00128 protected:
00129   vtkPoints(int dataType=VTK_FLOAT);
00130   ~vtkPoints() {};
00131   vtkPoints(const vtkPoints&) {};
00132   void operator=(const vtkPoints&) {};
00133 
00134   float Bounds[6];
00135   vtkTimeStamp ComputeTime; // Time at which bounds computed
00136 
00137 };
00138 
00139 inline void vtkPoints::SetNumberOfPoints(int number)
00140 {
00141   this->Data->SetNumberOfComponents(3);
00142   this->Data->SetNumberOfTuples(number);
00143 }
00144 
00145 inline void vtkPoints::SetPoint(int id, double x, double y, double z)
00146 {
00147   double p[3];
00148   p[0] = x;
00149   p[1] = y;
00150   p[2] = z;
00151   this->Data->SetTuple(id,p);
00152 }
00153 
00154 inline void vtkPoints::InsertPoint(int id, double x, double y, double z)
00155 {
00156   double p[3];
00157 
00158   p[0] = x;
00159   p[1] = y;
00160   p[2] = z;
00161   this->Data->InsertTuple(id,p);
00162 }
00163 
00164 inline int vtkPoints::InsertNextPoint(double x, double y, double z)
00165 {
00166   double p[3];
00167 
00168   p[0] = x;
00169   p[1] = y;
00170   p[2] = z;
00171   return this->Data->InsertNextTuple(p);
00172 }
00173 
00174 
00175 // These include files are placed here so that if Points.h is included 
00176 // all other classes necessary for compilation are also included. 
00177 #include "vtkIdList.h"
00178 
00179 #endif
00180 

Generated on Wed Nov 21 12:26:53 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001