#include //for atan2 #include "point.h" using namespace std; //Rotate this point around the X axis. point& point::xrot(double theta) { if (y != 0.0 || z != 0.0) { //if this point is not on the X axis, const double r = sqrt(y * y + z * z); theta += atan2(z, y); y = r * cos(theta); z = r * sin(theta); } return *this; } //Rotate this point around the Y axis. point& point::yrot(double theta) { if (z != 0.0 || x != 0.0) { //if this point is not on the Y axis, const double r = sqrt(z * z + x * x); theta += atan2(x, z); z = r * cos(theta); x = r * sin(theta); } return *this; } //Rotate this point around the Z axis. point& point::zrot(double theta) { if (x != 0.0 || y != 0.0) { //if this point is not on the Z axis, const double r = sqrt(x * x + y * y); theta += atan2(y, x); x = r * cos(theta); y = r * sin(theta); } return *this; }