![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsVertex.cpp 00003 00004 Vertex class is a class for 3D vertex (with normal direction). 00005 00006 SUKITTI PUNAK (10/29/2004) 00007 UPDATE (04/04/2005) 00008 ******************************************************************************/ 00009 #include "TAPsVertex.hpp" 00010 // Using Inclusion Model (i.e. definitions are included in declarations) 00011 // (this name.cpp is included in name.hpp) 00012 // Each friend is defined directly inside its declaration. 00013 00014 BEGIN_NAMESPACE_TAPs 00015 //============================================================================= 00016 // Constructors 00017 //----------------------------------------------------------------------------- 00018 template <typename T> 00019 Vertex<T>::Vertex ( T x, T y, T z, T u, T v, T w ) 00020 : m_vPosit( x, y, z ), m_vNormal( u, v, w ) 00021 {} 00022 //----------------------------------------------------------------------------- 00023 template <typename T> 00024 Vertex<T>::Vertex ( Vector3<T> position, Vector3<T> normal ) 00025 : m_vPosit( position ), m_vNormal( normal ) 00026 {} 00027 //----------------------------------------------------------------------------- 00028 template <typename T> 00029 Vertex<T>::Vertex ( T a[3] ) 00030 : m_vPosit( a[0], a[1], a[2] ), m_vNormal() 00031 {} 00032 //----------------------------------------------------------------------------- 00033 template <typename T> 00034 Vertex<T>::Vertex ( T a[3], T b[3] ) 00035 : m_vPosit( a[0], a[1], a[2] ), m_vNormal( b[0], b[1], b[2] ) 00036 {} 00037 //----------------------------------------------------------------------------- 00038 template <typename T> 00039 Vertex<T>::Vertex ( Vertex<T> const &v ) 00040 : m_vPosit( v.m_vPosit ), m_vNormal( v.m_vNormal ) 00041 {} 00042 //----------------------------------------------------------------------------- 00043 template <typename T> 00044 Vertex<T>::~Vertex () 00045 {} 00046 //----------------------------------------------------------------------------- 00047 //============================================================================= 00048 // Position Member Access i.e. return x, y, or z of this vertex position 00049 //----------------------------------------------------------------------------- 00050 template <typename T> 00051 inline T & Vertex<T>::operator[] ( int i ) 00052 { 00053 //assert( 0 <= i && i < 3 ); 00054 return m_vPosit[i]; 00055 } 00056 //----------------------------------------------------------------------------- 00057 template <typename T> 00058 inline T const & Vertex<T>::operator[] ( int i ) const 00059 { 00060 //assert( 0 <= i && i < 3 ); 00061 return m_vPosit[i]; 00062 } 00063 //============================================================================= 00064 // Assignment Operator 00065 //----------------------------------------------------------------------------- 00066 template <typename T> 00067 inline Vertex<T> & Vertex<T>::operator= ( Vertex<T> const &v ) 00068 { 00069 m_vPosit = v.m_vPosit; 00070 m_vNormal = v.m_vNormal; 00071 return *this; 00072 } 00073 //----------------------------------------------------------------------------- 00074 //============================================================================= 00075 END_NAMESPACE_TAPs 00076 //345678901234567890123456789012345678901234567890123456789012345678901234567890 00077 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8