Login | Register
My pages Projects Community openCollabNet

Discussions > dev > RE: [gef-dev] Repainting of edge lines...

gef
Discussion topic

Back to topic list

RE: [gef-dev] Repainting of edge lines...

Reply

Author "Christensen, Blake" <Blake dot Christensen at dsionline dot com>
Full name "Christensen, Blake" <Blake dot Christensen at dsionline dot com>
Date 2003-07-30 13:32:45 PDT
Message This thread has reminded me that there was/is a problem with the hit routine in FigLine which uses intersects. The routine checks for a square and not a line. I don't know if it causing the currently discussed problem.

Is/was:
   public boolean hit(Rectangle r) {
     return intersects(r);
   }

Should be something like:
   public boolean hit(Rectangle r) {
     double u;
     u = (r.x - _x1) * (_x2 - _x1) + (r.y - _y1) * (_y2 - _y1);
     u = u / ( Math.pow(_x2 -_x1,2) + Math.pow(_y2 - _y1,2));
     double x,y;
     x = _x1 + u * (_x2 - _x1);
     y = _y1 + u * (_y2 - _y1);
     double dist;
     dist = Math.sqrt(Math.pow(x-r.x,2) + Math.pow(y-r.y,2));
     return u >= 0 && u <= 1 && dist < 4;
   }


>Latest findings -
>
>intersects() method of FigEdgeLine doesn't appear to work properly when
>called on a FigEdgeLine and so the LayerDiagram.paintContents() doesn't know
>that some other item has intersected with that line.
>
>Any help welcomed, I'm struggling here.



--------------------​--------------------​--------------------​---------
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

RE: [gef-dev] Repainting of edge lines... "Christensen, Blake" <Blake dot Christensen at dsionline dot com> "Christensen, Blake" <Blake dot Christensen at dsionline dot com> 2003-07-30 13:32:45 PDT
Messages per page: