/*
 * call-seq:
 *  Shape.rotate(x, y, z, deg, duration)
 *  Shape.rotate(deg, duration)
 *
 * Rotate a shape about the axis that passes through the camera with 2 parameters. 
 * Otherwise if all ijk vector components are specified rotate about i, j, k vectors
 * by specified ammounts.
 *
 * As with other animations -1 is infinite and treats the parameters as units/sec. 
 * Duration of 0 seconds is instant. Other durations will divide the ammount of 
 * rotation over the desired duration to arrive at the specified configuration
 * when desired.
 *
 * === Parameters
 * * +x+ X component for 3D rotation
 * * +y+ Y component for 3D rotation
 * * +z+ Z component for 3D rotation
 * * +angle+ Angle in degrees to rotate
 * * +duration+ Duration of the rotation in seconds
 *  
 * === Examples
 *  # In 2D
 *  rect = Shape.rect(100, 100, 50, 80)
 *  rect.rotate(45, 0) # instantly rotate 45 degrees
 *  rect.rotate(10, -1) # rotate 10 degrees a second forever
 *  rect.rotate(-45, 1) # rotate 45 degrees in 1 second
 *
 *  # In 3D
 *  cube.rotate(10, 0, 0, 1) # rotate around the axis 10 deg in 1 second
 *
 */
static
VALUE rbc_shape_rotate(int argc, VALUE *argv, VALUE self)
{
    Shape *pshape;
    VALUE x, y, z, duration;

    Data_Get_Struct(self, Shape, pshape);
    rb_scan_args(argc, argv, "22", &x, &y, &z, &duration);

    // Assume we are operating in 2d 
    if(argc == 2)
    {
        a_rotate(pshape, 0, 0, x, y);
    }
    else
    {
        a_rotate(pshape, NUM2DBL(x), NUM2DBL(y), NUM2DBL(z), NUM2DBL(duration));
    }

    return Qnil;
}