/** * @param theta rotation angle around the z-axis. * @return rotated copy */ public Vector3d rotatedAboutZAxisBy(double theta) { double theta_CCWRAD = AngleRelative.toCcwRad(theta); double sin = Math.sin(theta_CCWRAD); double cos = Math.cos(theta_CCWRAD); double rotX = (x * cos) - (y * sin); double rotY = (x * sin) + (y * cos); return new Vector3d(rotX, rotY, z); }
/** * @param theta rotation angle around the x-axis. * @return rotated copy */ public Vector3d rotatedAboutXAxisBy(double theta) { double theta_CCWRAD = AngleRelative.toCcwRad(theta); double sin = Math.sin(theta_CCWRAD); double cos = Math.cos(theta_CCWRAD); double rotY = (y * cos) - (z * sin); double rotZ = (y * sin) + (z * cos); return new Vector3d(x, rotY, rotZ); }