29 Point(
float x_,
float y_) : x(x_), y(y_),
z(0) {}
39 Point(
float x_,
float y_,
float z_) : x(x_), y(y_),
z(z_) {}
62 Point operator*(
float scalar)
const;
63 bool operator==(
const Point& other)
const;
64 void operator+=(
const Point& other);
65 void operator/=(
float scalar);
66 void operator*=(
float scalar);
A struct representing a point in 3D space.
Definition point.h:12
float distance(const Point &other) const
Calculate the distance between this point and another point.
Definition point.cpp:8
float z
Coordinates of the point.
Definition point.h:13
friend std::ostream & operator<<(std::ostream &os, const Point &p)
Overload the << operator to print the point's coordinates.
Definition point.cpp:48
Point(float x_, float y_)
Construct a new Point object at the specified coordinates (z defaults to 0)
Definition point.h:29
Point(float x_, float y_, float z_)
Construct a new Point object at the specified coordinates.
Definition point.h:39
Point()
Construct a new Point object at the origin.
Definition point.h:20
float length() const
Calculate the length of the vector from the origin to this point.
Definition point.cpp:3