The Synthesis ToolKit in C++ (STK)

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
7namespace stk {
8
9/***************************************************/
17/***************************************************/
18
19 class Vector3D : public Stk
20{
21
22public:
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
50protected:
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
stk::Stk
STK base class.
Definition Stk.h:136
stk::Vector3D
STK 3D vector class.
Definition Vector3D.h:20
stk::Vector3D::Vector3D
Vector3D(StkFloat x=0.0, StkFloat y=0.0, StkFloat z=0.0)
Default constructor taking optional initial X, Y, and Z values.
Definition Vector3D.h:24
stk::Vector3D::getLength
StkFloat getLength(void)
Calculate the vector length.
Definition Vector3D.h:56
stk::Vector3D::setXYZ
void setXYZ(StkFloat x, StkFloat y, StkFloat z)
Set the X, Y, and Z values simultaniously.
Definition Vector3D.h:39
stk::Vector3D::setZ
void setZ(StkFloat z)
Set the Z value.
Definition Vector3D.h:48
stk::Vector3D::setY
void setY(StkFloat y)
Set the Y value.
Definition Vector3D.h:45
stk::Vector3D::setX
void setX(StkFloat x)
Set the X value.
Definition Vector3D.h:42
stk::Vector3D::getX
StkFloat getX(void)
Get the current X value.
Definition Vector3D.h:27
stk::Vector3D::getZ
StkFloat getZ(void)
Get the current Z value.
Definition Vector3D.h:33
stk::Vector3D::getY
StkFloat getY(void)
Get the current Y value.
Definition Vector3D.h:30
stk
The STK namespace.
Definition ADSR.h:6

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