A simple struct for 2D mathematics (points, vectors). More...
#include <Vector2D.h>

Public Member Functions | |
| Vector2D (float x, float y) | |
| Vector2D & | add (const Vector2D vec) |
| Adds another vector to this one. | |
| Vector2D & | subtract (const Vector2D vec) |
| Subtracts another vector from this one. | |
| Vector2D & | multiply (const Vector2D vec) |
| Multiplies this vector by another, component-wise. | |
| Vector2D & | divide (const Vector2D vec) |
| Divides this vector by another, component-wise. | |
| Vector2D & | operator+= (const Vector2D &vec) |
| Vector2D & | operator-= (const Vector2D &vec) |
| Vector2D & | operator*= (const Vector2D &vec) |
| Vector2D & | operator/= (const Vector2D &vec) |
| Vector2D & | operator* (const int &i) |
| Multiplies the vector by a scalar value. | |
| bool | operator== (const Vector2D &vec) |
| bool | operator! () |
| Vector2D & | zero () |
| Resets the vector's components to zero. | |
Public Attributes | |
| float | x |
| float | y |
Friends | |
| Vector2D | operator+ (Vector2D v1, const Vector2D &v2) |
| Vector2D | operator- (Vector2D v1, const Vector2D &v2) |
| Vector2D | operator* (Vector2D v1, const Vector2D &v2) |
| Vector2D | operator/ (Vector2D v1, const Vector2D &v2) |
| std::ostream & | operator<< (std::ostream &stream, const Vector2D &vec) |
A simple struct for 2D mathematics (points, vectors).
Provides basic vector operations like addition, subtraction, and scalar multiplication, along with overloaded operators for convenience.
Adds another vector to this one.
| vec | The vector to add. |

Divides this vector by another, component-wise.
| vec | The vector to divide by. |

Multiplies this vector by another, component-wise.
| vec | The vector to multiply by. |

Multiplies the vector by a scalar value.
| i | The scalar integer to multiply by. |

Subtracts another vector from this one.
| vec | The vector to subtract. |

| Vector2D & Vector2D::zero | ( | ) |
Resets the vector's components to zero.
