void xy2rc (double x, double y, int *row, int *col) { *col = (int) ((x-xMin) / (xMax-xMin) * winWidth); *row = (int) (winHeight - (y-yMin) / (yMax-yMin) * winHeight); }
generateDiagram
,
initialize the pixel pointer as follows:
p = ((winHeight-1-row)*winWidth + col) * 3;
eddie% matlab ... >> a=[1 2;3 4] a = 1 2 3 4 >> inv(a) ans = -2.0000 1.0000 1.5000 -0.5000 >> quit
NOTE this answer was corrected. The previous answer (a circle on x and y, with z unspecified), was for a cylinder parallel to the Z axis.
Note that the hit point may be above or below the cap. You have take care of that case.
To intersect the ray with the top and bottom caps of the cylinder, use the ray-plane method given in class and in the notes, and discard points that are:
initLights
, change the first line to:
GLfloat ambient[] = { 1.0, 1.0, 1.0, 1.0 };
rightShoulderAngle
moves the
robot's LEFT arm?