/************************************************************************ * * * File: point3.h * * * * Author: Robb T. Koether * * * * Date: Sep 9, 2003 * * * * Purpose: This file contains the definition of the Point3 class * * * ************************************************************************/ #ifndef POINT3_H #define POINT3_H // Header files #include #include #include "vector3.h" using namespace std; class Vector3; /************************************************************************ * * * The definition of the Point3 class * * * ************************************************************************/ class Point3 { // Public member functions public: // Inspectors Point3() : x(0), y(0), z(0) {} Point3(float xval, float yval, float zval) : x(xval), y(yval), z(zval) {} // Mutators void set(float xval, float yval, float zval) {x = xval; y = yval; z = zval;} void Output(ostream& out) const { out << "(" << x << ", " << y << ", " << z << ")"; } // Other functions Vector3 subtractP(const Point3& p) const; Point3 addV(const Vector3& v) const; Point3 subtractV(const Vector3& v) const; bool equal(const Point3& p) const; // Public data members public: float x; float y; float z; }; // Operators ostream& operator<<(ostream& out, const Point3& p); Point3 operator+(const Point3& p, const Vector3& v); Point3 operator-(const Point3& p, const Vector3& v); Vector3 operator-(const Point3& p, const Point3& q); bool operator==(const Point3& p, const Point3& q); #endif