summaryrefslogtreecommitdiff
path: root/display.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2004-10-04 20:58:01 +0000
committerEric S. Raymond <esr@thyrsus.com>2004-10-04 20:58:01 +0000
commitde21fef00a6108561c25bc4b7129c76ae02076de (patch)
tree3daddf0d09aa60ff6ba9041b285fb69d36ecf76a /display.c
parent365e6920239bff9a4bc1eab1b18702fe3f7a8ef2 (diff)
downloadgpsd-de21fef00a6108561c25bc4b7129c76ae02076de.tar.gz
Simplify the coordinate code.
Diffstat (limited to 'display.c')
-rw-r--r--display.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/display.c b/display.c
index 742ea50f..282a188d 100644
--- a/display.c
+++ b/display.c
@@ -50,22 +50,16 @@ void register_canvas(Widget w, GC gc)
static void pol2cart(double azimuth, double elevation, double *xout, double *yout)
{
- double sinelev;
-
azimuth *= DEG2RAD;
- elevation = 90.0 - elevation;
-
#ifdef PCORRECT
- elevation *= DEG2RAD;
- sinelev = sin(elevation) * SCALE;
+ elevation = sin((90.0 - elevation) * DEG2RAD);
#else
- sinelev = (elevation / 90.0) * SCALE;
+ elevation = ((90.0 - elevation) / 90.0);
#endif
- *xout = XCENTER + sin(azimuth) * sinelev;
- *yout = YCENTER - cos(azimuth) * sinelev;
+ *xout = XCENTER + sin(azimuth) * elevation * SCALE;
+ *yout = YCENTER - cos(azimuth) * elevation * SCALE;
}
-
static void draw_arc(int x, int y, int diam)
{
XDrawArc(XtDisplay(draww), pixmap, drawGC,
@@ -105,9 +99,9 @@ void draw_graphics(struct gps_data_t *gpsdata)
/* draw the 45 degree circle */
#ifdef PCORRECT
- draw_arc(width / 2, height / 2, ((i - RM) * 7) / 10); /* sin(45) ~ 0.7 */
+ draw_arc(width / 2, height / 2, (i - RM) * 0.7); /* sin(45) ~ 0.7 */
#else
- draw_arc(width / 2, height / 2, (i - RM) / 2);
+ draw_arc(width / 2, height / 2, (i - RM) * 0.5);
#endif
set_color("Black");