Update of /cvsroot/easycalc/easycalc
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv10208
Modified Files:
graph.c grtaps.c
Log Message:
Use user setting (Rad/Deg/Grd) for the angle parameter when plotting and
tracking polar graphs.
Index: graph.c
===================================================================
RCS file: /cvsroot/easycalc/easycalc/graph.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** graph.c 12 Sep 2006 19:40:55 -0000 1.48
--- graph.c 7 Oct 2006 20:37:36 -0000 1.49
***************
*** 583,588 ****
if (!finite(r))
return false;
! *x = r*cos(param);
! *y = r*sin(param);
return true;
--- 583,588 ----
if (!finite(r))
return false;
! *x = r*cos(math_user_to_rad(param));
! *y = r*sin(math_user_to_rad(param));
return true;
Index: grtaps.c
===================================================================
RCS file: /cvsroot/easycalc/easycalc/grtaps.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** grtaps.c 29 Sep 2006 01:56:41 -0000 1.26
--- grtaps.c 7 Oct 2006 20:37:36 -0000 1.27
***************
*** 578,582 ****
{
double realx,realy;
! double angle,r;
Coord oldx,oldy,dx,dy;
CodeStack *stack;
--- 578,584 ----
{
double realx,realy;
! double r;
! double angle_rad; /* angle in radians */
! double angle_usr; /* angle in user units: rad/deg/grad */
Coord oldx,oldy,dx,dy;
CodeStack *stack;
***************
*** 588,592 ****
oldx = oldy = -1;
! realx = realy = r = angle = NaN;
do {
EvtGetPen(&x,&y,&penDown);
--- 590,594 ----
oldx = oldy = -1;
! realx = realy = r = angle_rad = angle_usr = NaN;
do {
EvtGetPen(&x,&y,&penDown);
***************
*** 604,622 ****
realx = graph_xscr2gr(x);
realy = graph_yscr2gr(y);
! angle = NaN;
r = hypot(realx,realy);
if (r!=0.0) {
if (realx>=0.0 && realy>=0.0)
! angle = asin(realy/r);
else if (realx<=0.0)
! angle = M_PIl - asin(realy/r);
else
! angle = 2*M_PIl + asin(realy/r);
! func_get_value(stack,angle,&r,NULL);
! dx = graph_xgr2scr(r*cos(angle));
! dy = graph_ygr2scr(r*sin(angle));
! if (!finite(angle) || !RctPtInRectangle(dx,dy,bounds)) {
dy = -1;
dx = -1;
--- 606,625 ----
realx = graph_xscr2gr(x);
realy = graph_yscr2gr(y);
! angle_rad = angle_usr = NaN;
r = hypot(realx,realy);
if (r!=0.0) {
if (realx>=0.0 && realy>=0.0)
! angle_rad = asin(realy/r);
else if (realx<=0.0)
! angle_rad = M_PIl - asin(realy/r);
else
! angle_rad = 2*M_PIl + asin(realy/r);
! angle_usr = math_rad_to_user(angle_rad);
! func_get_value(stack,angle_usr,&r,NULL);
! dx = graph_xgr2scr(r*cos(angle_rad));
! dy = graph_ygr2scr(r*sin(angle_rad));
! if (!finite(angle_rad) || !RctPtInRectangle(dx,dy,bounds)) {
dy = -1;
dx = -1;
***************
*** 630,641 ****
grtaps_cross(crossX,crossY,bounds);
grtaps_print_coords(realx,realy,bounds);
! grtaps_print_pol(r,angle,bounds);
oldx = x;oldy = y;
crossX = dx;crossY=dy;
}
! }while(penDown);
if (RctPtInRectangle(x, y, bounds)) {
! lastParam = angle;
return true;
}
--- 633,644 ----
grtaps_cross(crossX,crossY,bounds);
grtaps_print_coords(realx,realy,bounds);
! grtaps_print_pol(r,angle_usr,bounds);
oldx = x;oldy = y;
crossX = dx;crossY=dy;
}
! } while(penDown);
if (RctPtInRectangle(x, y, bounds)) {
! lastParam = angle_usr;
return true;
}
|