void rotate(num horAngle, num verAngle)

Rotates this camera around the given horizontal and vertical angles.

Source

void rotate(num horAngle, num verAngle) {
  num horRadiance = horAngle * (Math.PI / 180);
  num verRadiance = verAngle * (Math.PI / 180);

  // First rotate around the y axis
  num x = center.x * Math.cos(horRadiance) + center.z * Math.sin(horRadiance);
  num y = center.y;
  num z = center.x * -(Math.sin(horRadiance)) + center.z * Math.cos(horRadiance);

  center = new Point3(x, y, z);

  // Then rotate up and down around origin
  num myAxisX = right.x;
  num myAxisY = right.y;
  num myAxisZ = right.z;

  num rotX = (myAxisX * myAxisX * (1 - Math.cos(verRadiance)) + Math.cos(verRadiance))* center.x + (myAxisX * myAxisY *(1 - Math.cos(verRadiance)) - myAxisZ * Math.sin(verRadiance))*center.y + (myAxisX * myAxisZ *(1 - Math.cos(verRadiance)) + myAxisY * Math.sin(verRadiance))*center.z;
  num rotY = (myAxisY * myAxisX * (1 - Math.cos(verRadiance)) + myAxisZ * Math.sin(verRadiance))*center.x + (myAxisY * myAxisY * (1 - Math.cos(verRadiance)) + Math.cos(verRadiance))*center.y + (myAxisY * myAxisZ * (1 - Math.cos(verRadiance)) - myAxisX * Math.sin(verRadiance))*center.z;
  num rotZ = (myAxisZ * myAxisX * (1 - Math.cos(verRadiance)) - myAxisY * Math.sin(verRadiance))*center.x + (myAxisZ * myAxisY * (1 - Math.cos(verRadiance)) + myAxisX * Math.sin(verRadiance))*center.y + (myAxisZ * myAxisZ * (1 - Math.cos(verRadiance)) + Math.cos(verRadiance))*center.z;

  center = new Point3(rotX, rotY, rotZ);
}