Login | Register
My pages Projects Community openCollabNet

Discussions > dev > FigCircle: better

gef
Discussion topic

Back to topic list

FigCircle: better

Reply

Author thn
Full name Thomas Neustupny
Date 2002-04-22 03:42:26 PDT
Message Hi GEFfies,

FigCircle.connectionPoint(Point anotherPt) is not overwritten
which causes to calculate points on the surrounding rectangle
(default Fig implementation) as connection points, instead of
returning a point that is on the border of the ellipse.

In ArgoUML, we use the implementation given below for use case
ellipses. Is this patch meaningful for FigCircle? I wonder
if it would break anything...
If not, feel free to submit it.

Thomas

+ public Point connectionPoint(Point anotherPt) {
+ //calculate border point of ellipse,
+ //that is on the edge between (_x,_y) and anotherPt
+ double rx = _w/2;
+ double ry = _h/2;
+ double dx = anotherPt.x - _x;
+ double dy = anotherPt.y - _y;
+ double dd = ry*ry*dx*dx + rx*rx*dy*dy;
+ double mu = rx*ry/Math.sqrt(dd);
+ Point res = new Point((int)(mu*dx+_x​+rx),(int)(mu*dy+_y+​ry));
+ //System.out.println(" returns "+res.x+','+res.y+')');
+ return res;
+ }

--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: dev-unsubscribe at gef dot tigris dot org
For additional commands, e-mail: dev-help at gef dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

FigCircle: better thn Thomas Neustupny 2002-04-22 03:42:26 PDT
Messages per page: