Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

Vector3D.h
1 #ifndef STK_VECTOR3D_H
2 #define STK_VECTOR3D_H
3
4 #include "Stk.h"
5 #include <cmath>
6
7 namespace stk {
8
9 /***************************************************/
17 /***************************************************/
18
19 class Vector3D : public Stk
20 {
21
22 public:
24 Vector3D( StkFloat x = 0.0, StkFloat y = 0.0, StkFloat z = 0.0 ) { setXYZ( x, y, z ); };
25
27 StkFloat getX( void ) { return X_; };
28
30 StkFloat getY( void ) { return Y_; };
31
33 StkFloat getZ( void ) { return Z_; };
34
36 StkFloat getLength( void );
37
39 void setXYZ( StkFloat x, StkFloat y, StkFloat z ) { X_ = x; Y_ = y; Z_ = z; };
40
42 void setX( StkFloat x ) { X_ = x; };
43
45 void setY( StkFloat y ) { Y_ = y; };
46
48 void setZ( StkFloat z ) { Z_ = z; };
49
50 protected:
51 StkFloat X_;
52 StkFloat Y_;
53 StkFloat Z_;
54 };
55
56 inline StkFloat Vector3D :: getLength( void )
57 {
58 StkFloat temp;
59 temp = X_ * X_;
60 temp += Y_ * Y_;
61 temp += Z_ * Z_;
62 temp = sqrt( temp );
63 return temp;
64 }
65
66 } // stk namespace
67
68 #endif

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