00001
00003
00004
00005
00006
00007
#ifndef _VECTOR3D_H_
00008
#define _VECTOR3D_H_
00009
00010
00011
#include "../src/main.h"
00012
00013
00019
00020 class Vector3D
00021 {
00022
protected:
00024 GLfloat
x_coordinate_;
00026 GLfloat
y_coordinate_;
00028 GLfloat
z_coordinate_;
00030 GLfloat
w_coordinate_;
00031
00032
public:
00033
00037 Vector3D() {};
00038
00039
00043 Vector3D(
Vector3D *vector) :
00044
x_coordinate_(vector->
getXCoord()),
00045
y_coordinate_(vector->
getYCoord()),
00046
z_coordinate_(vector->
getZCoord()),
00047
w_coordinate_(vector->
getWCoord())
00048 {
00049 }
00050
00051
00060
00061 Vector3D(GLfloat x_coord, GLfloat y_coord, GLfloat z_coord, GLfloat w_coord) :
00062
x_coordinate_(x_coord),
00063
y_coordinate_(y_coord),
00064
z_coordinate_(z_coord),
00065
w_coordinate_(w_coord)
00066 {
00067 }
00068
00069
00074 GLfloat
getXCoord()
const
00075
{
00076
return(
x_coordinate_);
00077 }
00078
00079
00084
00085 GLfloat
getYCoord()
const
00086
{
00087
return(
y_coordinate_);
00088 }
00089
00090
00095
00096 GLfloat
getZCoord()
const
00097
{
00098
return(
z_coordinate_);
00099 }
00100
00101
00106
00107 GLfloat
getWCoord()
const
00108
{
00109
return(
w_coordinate_);
00110 }
00111
00112
00117
00118 void setXCoord(GLfloat x_coord)
00119 {
00120
x_coordinate_ = x_coord;
00121 }
00122
00123
00128
00129 void setYCoord(GLfloat y_coord)
00130 {
00131
y_coordinate_ = y_coord;
00132 }
00133
00134
00139
00140 void setZCoord(GLfloat z_coord)
00141 {
00142
z_coordinate_ = z_coord;
00143 }
00144
00145
00150
00151 void setWCoord(GLfloat w_coord)
00152 {
00153
w_coordinate_ = w_coord;
00154 }
00155
00156
00163
00164 Vector3D operator+(
Vector3D an_other_vector)
00165 {
00166
return(
Vector3D(an_other_vector.
getXCoord() +
x_coordinate_,
00167 an_other_vector.
getYCoord() +
y_coordinate_,
00168 an_other_vector.
getZCoord() +
z_coordinate_,
00169 an_other_vector.
getWCoord() +
w_coordinate_));
00170 }
00171
00172
00179
00180 Vector3D operator-(
Vector3D an_other_vector)
00181 {
00182
return(
Vector3D(
x_coordinate_ - an_other_vector.
getXCoord(),
00183
y_coordinate_ - an_other_vector.
getYCoord(),
00184
z_coordinate_ - an_other_vector.
getZCoord(),
00185
w_coordinate_ - an_other_vector.
getWCoord()));
00186 }
00187
00188
00194
00195 Vector3D operator*(GLfloat scalar)
00196 {
00197
return(
Vector3D(
x_coordinate_ * scalar,
00198
y_coordinate_ * scalar,
00199
z_coordinate_ * scalar,
00200
w_coordinate_ * scalar));
00201 }
00202
00203
00209
00210 Vector3D operator/(GLfloat scalar)
00211 {
00212
return(
Vector3D(
x_coordinate_ / scalar,
00213
y_coordinate_ / scalar,
00214
z_coordinate_ / scalar,
00215
w_coordinate_ / scalar));
00216 }
00217 };
00218
00219
00220
#endif // _VECTOR3D_H_
00221
00222