-
Notifications
You must be signed in to change notification settings - Fork 0
/
rPointi.cpp
162 lines (157 loc) · 2.67 KB
/
rPointi.cpp
1
//#include <iostream.h>#include <math.h>#include "rPointi.h"/* * Class declarations */int rPointi::operator==(rPointi p){ return (x == p.x && y == p.y && z == p.z);}int rPointi::operator!=(rPointi p){ return (x != p.x || y != p.y || z != p.z);}int rPointi::operator<=(rPointi p){ return (x <= p.x && y <= p.y && z <= p.z);}int rPointi::operator>=(rPointi p){ return (x >= p.x && y >= p.y && z >= p.z);}int rPointi::operator>(rPointi p){ return (x > p.x && y > p.y && z > p.z);}int rPointi::operator<(rPointi p){ return (x < p.x && y < p.y && z < p.z);}/*void rPointi::dout (){ cout <<" x:"<< x <<" y:"<<y<<" z:"<<z << "\n";}*/rPointi& rPointi::operator+=(rPointi b){ x += b.x; y += b.y; z += b.z; return (*this);}rPointi& rPointi::operator+(int s){ x += s; y += s; z += s; return (*this);}rPointi& rPointi::operator+=(int s){ x += s; y += s; z += s; return (*this);}/* Subtract two rPoints. */rPointi& rPointi::operator-=(rPointi b){ x -= b.x; y -= b.y; z -= b.z; return (*this);}rPointi& rPointi::operator-(int s){ x -= s; y -= s; z -= s; return (*this);}rPointi& rPointi::operator-=(int s){ x -= s; y -= s; z -= s; return (*this);}/* Multiply two rPoints. */rPointi operator*(rPointi a, rPointi b){ rPointi c; c.x = a.x * b.x; c.y = a.y * b.y; c.z = a.z * b.z; return (c);}rPointi& rPointi::operator*=(rPointi b){ x *= b.x; y *= b.y; z *= b.z; return (*this);}rPointi& rPointi::operator*(int s){ x *= s; y *= s; z *= s; return (*this);}rPointi& rPointi::operator*=(int s){ x *= s; y *= s; z *= s; return (*this);}/* Divide two rPoints. */rPointi operator/(rPointi a, rPointi b){ rPointi c; c.x = a.x / b.x; c.y = a.y / b.y; c.z = a.z / b.z; return (c);}rPointi& rPointi::operator/=(rPointi b){ x /= b.x; y /= b.y; z /= b.z; return (*this);}rPointi& rPointi::operator/(int s){ x /= s; y /= s; z /= s; return (*this);}rPointi& rPointi::operator/=(int s){ x /= s; y /= s; z /= s; return (*this);}/* Add rPointis by scalars. */rPointi operator+(int a,rPointi b){ rPointi c(a+b.x,a+b.y,a+b.z); return c;}rPointi operator+(rPointi b,int a){ rPointi c(a+b.x,a+b.y,a+b.z); return c;}/* Subtract rPointis by scalars. */rPointi operator-(int a,rPointi b){ rPointi c(a-b.x,a-b.y,a-b.z); return c;}rPointi operator-(rPointi b,int a){ rPointi c(a-b.x,a-b.y,a-b.z); return c;}/* Add two rPointis */rPointi operator+(rPointi a,rPointi b){ rPointi c(a.x+b.x,a.y+b.y,a.z+b.z); return c;}/* Subtract two rPointis. */rPointi operator-(rPointi a,rPointi b){ rPointi c(a.x-b.x,a.y-b.y,a.z-b.z); return c;}