Here is a 3D vector class I made from the source of 2DVectorClass. It lacks the method "perpendicular," and rotations/angles have been defined as around the positive x, y, or z axis (in the YZ, ZX, or XY planes).