1 |
kusanagi |
1.1 |
// cVector.h: interface for the cVector class.
|
2 |
|
|
//
|
3 |
|
|
// Copyright 2003 (c) Michael F. Henry
|
4 |
|
|
//
|
5 |
|
|
//////////////////////////////////////////////////////////////////////
|
6 |
|
|
#pragma once
|
7 |
|
|
|
8 |
|
|
class cVector
|
9 |
|
|
{
|
10 |
|
|
public:
|
11 |
|
|
cVector(double x = 0.0, double y = 0.0, double z = 0.0, double w = 0.0) :
|
12 |
|
|
m_x(x), m_y(y), m_z(z), m_w(w) {}
|
13 |
|
|
virtual ~cVector() {};
|
14 |
|
|
|
15 |
|
|
void Sub(const cVector&); // subtraction
|
16 |
|
|
void Mul(double factor); // multiply each component by 'factor'
|
17 |
|
|
|
18 |
|
|
double Angle(const cVector&) const; // angle between two vectors
|
19 |
|
|
double Magnitude() const; // vector magnitude
|
20 |
|
|
double Dot(const cVector& vec) const; // dot product
|
21 |
|
|
|
22 |
|
|
// protected:
|
23 |
|
|
double m_x;
|
24 |
|
|
double m_y;
|
25 |
|
|
double m_z;
|
26 |
|
|
double m_w;
|
27 |
|
|
};
|