#include <HxVectorR2.h>
Public Methods | |
| HxVectorR2 () | |
| Constructor. More... | |
| HxVectorR2 (double d1, double d2) | |
| Constructor. More... | |
| HxVectorR2 (const HxPointR2 &p1, const HxPointR2 &p2) | |
| Constructor : p1-p2. More... | |
| double | x () const |
| Get the first element of the vector. More... | |
| double | y () const |
| Get the second element of the vector. More... | |
| HxVectorR2 | add (const HxVectorR2 &arg) const |
| Add the given vector to this. More... | |
| HxVectorR2 | sub (const HxVectorR2 &arg) const |
| Subtract the given vector from this. More... | |
| HxVectorR2 | mul (double arg) const |
| Multiply this vector with a scalar. More... | |
| HxVectorR2 | div (double arg) const |
| Divide this vector by a scalar. More... | |
| double | dot (const HxVectorR2 &arg) const |
| Dot product. More... | |
| double | cross2D (const HxVectorR2 &arg) const |
| Cross product (?). More... | |
| double | magnitude () const |
| Magnitude. More... | |
| double | squaredMagnitude () const |
| Squared magnitude. More... | |
| HxVectorR2 | normal () const |
| Normal. More... | |
| STD_OSTREAM & | put (STD_OSTREAM &) const |
| Put the arrow on the given stream. More... | |
| STD_OSTREAM & | dump (HxVectorR2 &) const |
| HxString | toString () const |
Friends | |
| class | HxPointR2 |
|
|
Constructor.
00087 : _data(0,0)
00088 {
00089 }
|
|
||||||||||||
|
Constructor.
00092 : _data(d1, d2)
00093 {
00094 }
|
|
||||||||||||
|
Constructor : p1-p2.
00016 {
00017 _data = HxVec2Double(p1.x()-p2.x(), p1.y()-p2.y());
00018 }
|
|
|
Get the first element of the vector.
00098 {
00099 return _data.x();
00100 }
|
|
|
Get the second element of the vector.
00104 {
00105 return _data.y();
00106 }
|
|
|
Add the given vector to this.
00110 {
00111 return HxVectorR2( _data.x()+arg.x(), _data.y()+arg.y());
00112 }
|
|
|
Subtract the given vector from this.
00116 {
00117 return HxVectorR2( _data.x()-arg.x(), _data.y()-arg.y());
00118 }
|
|
|
Multiply this vector with a scalar.
00122 {
00123 return HxVectorR2( _data.x()*arg, _data.y()*arg);
00124 }
|
|
|
Divide this vector by a scalar.
00128 {
00129 return HxVectorR2( _data.x()/arg, _data.y()/arg);
00130 }
|
|
|
Dot product.
|
|
|
Cross product (?).
|
|
|
Magnitude.
|
|
|
Squared magnitude.
|
|
|
Normal.
00158 {
00159 return HxVectorR2(_data.y(), -_data.x());
00160 }
|
|
|
Put the arrow on the given stream.
00170 {
00171 return os << _data;
00172 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001