[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: a_pan.nw
User: werner
Date: 06/04/15 10:00:09
Modified: . a_pan.nw o_arc.nw
Log:
ARC_END_ANGLE calculation corrected, fixes bug 1468682
Revision Changes Path
1.9 +3 -3 eda/geda/devel/gschem/noweb/a_pan.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: a_pan.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/a_pan.nw,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- a_pan.nw 14 Apr 2006 11:49:27 -0000 1.8
+++ a_pan.nw 15 Apr 2006 14:00:09 -0000 1.9
@@ -218,10 +218,10 @@
will lead the a redraw of the rubberbands with the next
motion event */
w_current->last_x = w_current->second_x = w_current->start_x;
- w_current->save_x = w_current->loc_x = w_current->start_x;
+ w_current->save_x = w_current->start_x;
w_current->last_y = w_current->second_y = w_current->start_y;
- w_current->save_y = w_current->loc_y = w_current->start_y;
- w_current->distance = 0;
+ w_current->save_y = w_current->start_y;
+ w_current->distance = w_current->loc_y = w_current->loc_x = 0;
}
/* redraw */
1.11 +4 -18 eda/geda/devel/gschem/noweb/o_arc.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_arc.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_arc.nw,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- o_arc.nw 4 Feb 2005 04:39:29 -0000 1.10
+++ o_arc.nw 15 Apr 2006 14:00:09 -0000 1.11
@@ -1148,7 +1148,7 @@
void
o_arc_rubberarc(TOPLEVEL *w_current, int x, int y, int whichone)
{
- double d, dx, dy, sin_a_, cos_a_, a;
+ double dx, dy, a;
int diff_x, diff_y;
/* erase the previous temporary arc */
@@ -1195,21 +1195,7 @@
/* compute the angle */
dx = ((double) x) - ((double) w_current->start_x);
dy = - ((double) y) + ((double) w_current->start_y);
-d = sqrt((dx * dx) + (dy * dy));
-
-sin_a_ = dy / ((double) d);
-cos_a_ = dx / ((double) d);
-a = asin(sin_a_) * 180 / M_PI;
-if(a < 0) a *= -1;
-
-/* find the right quadrant */
-if(sin_a_ >= 0) {
- if(cos_a_ >= 0) a = a;
- else a = 180 - a;
-} else {
- if(cos_a_ >= 0) a = 360 - a;
- else a = 180 + a;
-}
+a = atan2(dy,dx) * 180 / M_PI;
@
@@ -1218,11 +1204,11 @@
/* set the start or end angle with this angle */
switch(whichone) {
case ARC_START_ANGLE:
- w_current->loc_x = (int) a;
+ w_current->loc_x = ((int) a + 360) % 360;
break;
case ARC_END_ANGLE:
- w_current->loc_y = (int) a;
+ w_current->loc_y = ((int) a - w_current->loc_x + 720) % 360;
break;
default: