






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Trigonometry Review
-^ Angles and co-ordinates^ –^
The^ unit circle
is the set of all points exactly one unit away from the origin. In fact, radians measure arclength on theunit circle. (The unit circle has a circumference of 2
π.)
-^ sin()
and^ cos()
are functions that give the vertical and horizontal positions (respectively) of a point on the unitcircle at angle
theta.
Trigonometry Review
-^ Angles, co-ordinates, and radius^ –
sin() and cos() return the (X,Y) co-ordinates on theunit circle. – To get a bigger circle, multiply sin() and cos() by a^ radius
. The
radius
is the distance from the origin.
-^ For example, say theta=45° and r=5.Then X=rcos(theta) and Y=rsin(theta), orX=5cos(45°) and Y=5sin(45°).
in one dimension
.
-^ X=sin(t), Y=cos(t) are
in one dimension
and produce 2D results.
x,^ y; double
t; glBegin(GL_LINE_STRIP);for^ (t
=^ -5;
t<=5;
t+=0.01)
{^ evalFn
(t,^ x,
y); glVertex3f(x,y,0);} glEnd();}
void^ evalFn(double
t, double
&x, double
&y) { x^ =^
cos(t);y = sin(t);
void drawFunction(void){ Vec^ A,
for^ (double
u^ =^ -1;
u<=1; u+=0.1) for^ (double
v^ =^ -1;
v<=1;^
v+=0.1)
{ A^ =^ evalFn(u,
v); B^ =^ evalFn(u,
v+0.1); C^ =^ evalFn(u+0.1,
v+0.1); D^ =^ evalFn(u+0.1,
v); glBegin(GL_QUADS);glVertex3f(A.x(),A.y(),A.z());glVertex3f(B.x(),B.y(),B.z());glVertex3f(C.x(),C.y(),C.z());glVertex3f(D.x(),D.y(),D.z());glEnd();} }
Vec^ evalFn(double
u,double v) { double
x,^ y,^
z; x^ =^ cos(PIu)sin(PI*(v-1)/2);y^ =^
cos(PI(v-1)/2); z^ =^ sin(PIu)sin(PI(v-1)/2);return^ Vec(x,y,z);}