Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Education
»
mathteach
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
Re: Why trig? and circles and so on
Replies:
1
Last Post:
Apr 1, 1997 3:25 PM




Re: Why trig? and circles and so on
Posted:
Apr 1, 1997 12:01 PM


Addressed to: Jack Roach <jroach@neosoft.com> mathteach@forum.swarthmore.edu
** Reply to note from Jack Roach <jroach@neosoft.com> Tue, 1 Apr 1997 10:32:49 0600 (CST)
> I'm not so sure that it's all that "practical" but in any case, the way > it's usually done makes no real use of trigonometry. As it turns out, I'm feeding myself just now, in part, writing programs that draw circles. Actually, slightly more than circles, tape measures. A closed tape measure in this case is a circle with a button in the middle and a tape tab on the edge. Pulling on the tab gets you the tape.
This tape is modeled on one my wife carried in her purse a while ago.
Drawing circles is done by saying, more or less, draw a circle over there and make it this big. More precisely:
g.drawOval(center_x05,center_y05,10,10);
What trig is involved, if any, I don't know cause I've not looked inside drawOval. I'd do it with pythagoras, however.
But where to put the tab on the side of my tape measure is done this way: /* Circle and button done, now the tab */ double dx,dy; /* increments for corners of tab */ double bx,by; /* starting point for corners, on midline */ double [] px,py; /* coordinates of the three corners */ int [] ix,iy; /* integer versions */ int x1,x2,y1,y2; /* sloppy */ px=new double[4]; py=new double[4]; ix=new int[4]; iy=new int[4]; dx=Math.cos(theta); dy=Math.sin(theta); bx=Math.cos(theta)*(25+length)+center_x; by=Math.sin(theta)*(25+length)+center_y; px[0]=bx8*dy; py[0]=by+8*dx; px[1]=px[0]+16*dx; py[1]=py[0]+16*dy; px[2]=px[1]+16*dy; py[2]=py[1]16*dx; px[3]=px[2]16*dx; py[3]=py[2]16*dy; g.setColor(new Color(123,123,123)); tab_c_x=(int)(px[0]+px[2])/2; tab_c_y=(int)(py[0]+py[2])/2; for(int i=0; i<=3; i++){ ix[i]=(int)px[i]; iy[i]=(int)py[i];}
************************************************************************ * George Yanos * * GYanos@uic.edu * * 7088484221 * * Fax:6303230924 * ************************************************************************



