Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


Vector3D.h

00001 #ifndef STK_VECTOR3D_H
00002 #define STK_VECTOR3D_H
00003 
00004 #include "Stk.h"
00005 #include <cmath>
00006 
00007 namespace stk {
00008 
00009 /***************************************************/
00017 /***************************************************/
00018 
00019 class Vector3D : public Stk
00020 {
00021 
00022 public:
00024   Vector3D( StkFloat x = 0.0, StkFloat y = 0.0, StkFloat z = 0.0 ) { setXYZ( x, y, z ); };
00025 
00027   StkFloat getX( void ) { return X_; };
00028 
00030   StkFloat getY( void ) { return Y_; };
00031 
00033   StkFloat getZ( void ) { return Z_; };
00034 
00036   StkFloat getLength( void );
00037 
00039   void setXYZ( StkFloat x, StkFloat y, StkFloat z ) { X_ = x; Y_ = y; Z_ = z; };
00040 
00042   void setX( StkFloat x ) { X_ = x; };
00043 
00045   void setY( StkFloat y ) { Y_ = y; };
00046 
00048   void setZ( StkFloat z ) { Z_ = z; };
00049 
00050 protected:
00051   StkFloat X_;
00052   StkFloat Y_;
00053   StkFloat Z_;
00054 };
00055 
00056 inline StkFloat Vector3D :: getLength( void )
00057 {
00058   StkFloat temp;
00059   temp = X_ * X_;
00060   temp += Y_ * Y_;
00061   temp += Z_ * Z_;
00062   temp = sqrt( temp );
00063   return temp;
00064 }
00065 
00066 } // stk namespace
00067 
00068 #endif

The Synthesis ToolKit in C++ (STK)
©1995-2010 Perry R. Cook and Gary P. Scavone. All Rights Reserved.