Pt class
Pt class
back to menu
This class describes points in 3D and allows basics operations on them.
class Pt {
public:
Pt() : X(0), Y(0), Z(0){}; default constructor
Pt(double x, double y, double z) : X(x), Y(y), Z(z){};constructor
Pt (const Pt& p) : X(p.X), Y(p.Y), Z(p.Z){};copy constructor
Pt operator =(const Pt& p);affectation operator
coordinates
double X;
double Y;
double Z;
inline void operator+=(const Pt p);add the coordinates of two points
inline void operator*=(const double d);multiply coordinates by d
inline void operator/=(const double d);divide coordinates by d - output an error if d = 0
inline bool operator==(const Pt &p) const;comparaison operator
};
const Pt operator + (const Pt &p, const Vec &v);add a vector to a point
const Vec operator-(const Pt &p1, const Pt &p2);gives the vector from p2 to p1
back to menu