AzerothCore 3.3.5a OpenSource WoW Emulator
Searching...
No Matches
Vec2D Class Reference

`#include "vec3d.h"`

## Public Member Functions

Vec2D (float x0=0.0f, float y0=0.0f)

Vec2D (const Vec2D &v)

Vec2Doperator= (const Vec2D &v)

Vec2D operator+ (const Vec2D &v) const

Vec2D operator- (const Vec2D &v) const

float operator* (const Vec2D &v) const

Vec2D operator* (float d) const

Vec2Doperator+= (const Vec2D &v)

Vec2Doperator-= (const Vec2D &v)

Vec2Doperator*= (float d)

float lengthSquared () const

float length () const

Vec2Dnormalize ()

Vec2D operator~ () const

operator float * ()

float x

float y

## Friends

Vec2D operator* (float d, const Vec2D &v)

std::istream & operator>> (std::istream &in, Vec2D &v)

## ◆ Vec2D() [1/2]

 Vec2D::Vec2D ( float x0 = `0.0f`, float y0 = `0.0f` )
inline
152: x(x0), y(y0) {}
float x
Definition: vec3d.h:150
float y
Definition: vec3d.h:150

## ◆ Vec2D() [2/2]

 Vec2D::Vec2D ( const Vec2D & v )
inline
154: x(v.x), y(v.y) {}

## ◆ length()

 float Vec2D::length ( ) const
inline
218 {
219 return std::sqrt(x * x + y * y);
220 }

References x, and y.

Referenced by normalize().

## ◆ lengthSquared()

 float Vec2D::lengthSquared ( ) const
inline
213 {
214 return x * x + y * y;
215 }

References x, and y.

## ◆ normalize()

 Vec2D & Vec2D::normalize ( )
inline
223 {
224 this->operator*= (1.0f / length());
225 return *this;
226 }
float length() const
Definition: vec3d.h:217
Vec2D & operator*=(float d)
Definition: vec3d.h:205

References length(), and operator*=().

Referenced by operator~().

## ◆ operator float *()

 Vec2D::operator float * ( )
inline
242 {
243 return (float*)this;
244 }

## ◆ operator*() [1/2]

 float Vec2D::operator* ( const Vec2D & v ) const
inline
176 {
177 return x * v.x + y * v.y;
178 }

References x, and y.

## ◆ operator*() [2/2]

 Vec2D Vec2D::operator* ( float d ) const
inline
181 {
182 Vec2D r(x * d, y * d);
183 return r;
184 }
Definition: vec3d.h:148

References x, and y.

## ◆ operator*=()

 Vec2D & Vec2D::operator*= ( float d )
inline
206 {
207 x *= d;
208 y *= d;
209 return *this;
210 }

References x, and y.

Referenced by normalize().

## ◆ operator+()

 Vec2D Vec2D::operator+ ( const Vec2D & v ) const
inline
164 {
165 Vec2D r(x + v.x, y + v.y);
166 return r;
167 }

References x, and y.

## ◆ operator+=()

 Vec2D & Vec2D::operator+= ( const Vec2D & v )
inline
192 {
193 x += v.x;
194 y += v.y;
195 return *this;
196 }

References x, and y.

## ◆ operator-()

 Vec2D Vec2D::operator- ( const Vec2D & v ) const
inline
170 {
171 Vec2D r(x - v.x, y - v.y);
172 return r;
173 }

References x, and y.

## ◆ operator-=()

 Vec2D & Vec2D::operator-= ( const Vec2D & v )
inline
199 {
200 x -= v.x;
201 y -= v.y;
202 return *this;
203 }

References x, and y.

## ◆ operator=()

 Vec2D & Vec2D::operator= ( const Vec2D & v )
inline
157 {
158 x = v.x;
159 y = v.y;
160 return *this;
161 }

References x, and y.

## ◆ operator~()

 Vec2D Vec2D::operator~ ( ) const
inline
229 {
230 Vec2D r(*this);
231 r.normalize();
232 return r;
233 }

References normalize().

## ◆ operator*

 Vec2D operator* ( float d, const Vec2D & v )
friend
187 {
188 return v * d;
189 }

## ◆ operator>>

 std::istream & operator>> ( std::istream & in, Vec2D & v )
friend
236 {
237 in >> v.x >> v.y;
238 return in;
239 }