Return Vector2d(v.x / magnitude, v.y / magnitude) Vector2d Vector2d::Normal(const Vector2d &v) Vector2d Vector2d::operator/(const float& scalar) constįloat Vector2d::DotProduct(const Vector2d &a, const Vector2d &b)įloat Vector2d::CrossProduct(const Vector2d &a, const Vector2d &b)įloat Vector2d::Magnitude(const Vector2d &v) Vector2d Vector2d::operator*(const float& scalar) const
Return (x*x + y*y) > (v.x*v.x + v.y*v.y) ||īool Vector2d::operator<=(const Vector2d &v) const Vector2d Vector2d::operator/(const Vector2d &v) constīool Vector2d::operator=(const Vector2d &v) constīool Vector2d::operator>(const Vector2d &v) const
Vector2d Vector2d::operator*(const Vector2d &v) const Vector2d Vector2d::operator-(const Vector2d &v) const Vector2d Vector2d::operator+(const Vector2d &v) const Vector2d::Vector2d(float sourceX, float sourceY) *Check which Vectors are closer or further from the Check if the Vectors have the same values. Vector2d operator/(const Vector2d&) const Vector2d operator*(const Vector2d&) const Vector2d operator-(const Vector2d&) const Vector2d operator+(const Vector2d&) const Have operations performed on the relative (x, y) values*/ *The following operators simply return Vector2ds that Constructor assigns the inputs to x and y. *The x and y values are public to give easier access for
Certain operators are overloaded to make it easier *The Vector2d class is an object consisting of simply an x and I'd like to get some review on a simple class that I've made. I don't really know any of the 'best practices'.
I've never actually done professional C++.