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

common/vtkNormals.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkNormals.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 =========================================================================*/
00054 #ifndef __vtkNormals_h
00055 #define __vtkNormals_h
00056 
00057 #include "vtkAttributeData.h"
00058 
00059 class vtkIdList;
00060 class vtkNormals;
00061 
00062 class VTK_EXPORT vtkNormals : public vtkAttributeData
00063 {
00064 public:
00065   static vtkNormals *New(int dataType);
00066   static vtkNormals *New();
00067 
00068   vtkTypeMacro(vtkNormals,vtkAttributeData);
00069   void PrintSelf(ostream& os, vtkIndent indent);
00070 
00072   vtkAttributeData *MakeObject()
00073     {return vtkNormals::New(this->GetDataType());}
00074   
00076   int GetNumberOfNormals() 
00077     {return this->Data->GetNumberOfTuples();}
00078 
00080   float *GetNormal(int id) 
00081     {return this->Data->GetTuple(id);}
00082   
00085   void GetNormal(int id, float n[3]) 
00086     {this->Data->GetTuple(id,n);}
00087   void GetNormal(int id, double n[3]) 
00088     {this->Data->GetTuple(id,n);}
00089   
00093   void SetNormal(int id, const float n[3]) 
00094     {this->Data->SetTuple(id,n);}
00095   void SetNormal(int id, const double n[3]) 
00096     {this->Data->SetTuple(id,n);}
00097   void SetNormal(int id, double nx, double ny, double nz);
00098 
00101   void InsertNormal(int id, const double n[3]) 
00102     {this->Data->InsertTuple(id,n);}
00103   void InsertNormal(int id, float n[3]) 
00104     {this->Data->InsertTuple(id,n);}
00105   void InsertNormal(int id, double nx, double ny, double nz);
00106 
00108   int InsertNextNormal(const float n[3]) 
00109     {return this->Data->InsertNextTuple(n);}
00110   int InsertNextNormal(const double n[3]) 
00111     {return this->Data->InsertNextTuple(n);}
00112   int InsertNextNormal(double nx, double ny, double nz);
00113 
00117   void SetNumberOfNormals(int number);
00118 
00120   void GetNormals(vtkIdList *ptId, vtkNormals *fn);
00121 
00122 #ifndef VTK_REMOVE_LEGACY_CODE
00123 
00124   void GetNormals(vtkIdList& ptId, vtkNormals& fn) 
00125     {VTK_LEGACY_METHOD(GetNormals,"3.2"); this->GetNormals(&ptId, &fn);}
00126 #endif
00127   
00128 protected:
00129   vtkNormals();
00130   ~vtkNormals() {};
00131   vtkNormals(const vtkNormals&) {};
00132   void operator=(const vtkNormals&) {};
00133   
00134 };
00135 
00136 
00137 inline void vtkNormals::SetNumberOfNormals(int number)
00138 {
00139   this->Data->SetNumberOfComponents(3);
00140   this->Data->SetNumberOfTuples(number);
00141 }
00142 
00143 inline void vtkNormals::SetNormal(int id, double nx, double ny, double nz)
00144 {
00145   double n[3];
00146   n[0] = nx;
00147   n[1] = ny;
00148   n[2] = nz;
00149   this->Data->SetTuple(id,n);
00150 }
00151 
00152 inline void vtkNormals::InsertNormal(int id, double nx, double ny, double nz)
00153 {
00154   double n[3];
00155 
00156   n[0] = nx;
00157   n[1] = ny;
00158   n[2] = nz;
00159   this->Data->InsertTuple(id,n);
00160 }
00161 
00162 inline int vtkNormals::InsertNextNormal(double nx, double ny, double nz)
00163 {
00164   double n[3];
00165 
00166   n[0] = nx;
00167   n[1] = ny;
00168   n[2] = nz;
00169   return this->Data->InsertNextTuple(n);
00170 }
00171 
00172 
00173 // These include files are placed here so that if Normals.h is included 
00174 // all other classes necessary for compilation are also included. 
00175 #include "vtkIdList.h"
00176 
00177 #endif

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