// // point3d.h // // A point in 3d space // // Copyright (C) J. Belson 1998.11.30 // #ifndef _POINT3D_H_ #define _POINT3D_H_ #include #include "fcolour.h" #include "point2d.h" #include "types.h" #include "vector3d.h" class point2d; /** * Represents a point in 3d space */ class point3d { private: public: point3d(float x, float y, float z); point3d() { x = y = z = 0.0; }; ~point3d() {} // Vertex co-ordinates float x, y, z; // Vertex colour fcolour col; void get(float *x, float *y, float *z) const; void set(float x, float y, float z); void set_colour(uint8 red, uint8 green, uint8 blue); void set_colour(const fcolour& c); fcolour get_colour(void) const; // Get vector joining two points vector3d operator-(const point3d& p) const; // Apply vector to point point3d operator+(const vector3d& v) const; // Scale point point3d operator*(double f); point3d operator=(const point3d& p); operator point2d(); friend std::ostream& operator<<(std::ostream& str, const point3d& p); }; #endif // _POINT3D_H_