Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [GEF4] geometry intersections accuracy
[GEF4] geometry intersections accuracy [message #1719698] Mon, 11 January 2016 14:38 Go to next message
Sylvain Bi is currently offline Sylvain BiFriend
Messages: 10
Registered: May 2015
Junior Member
Hello, when I look for intersections between an Ellipse and a Line the rendering seems incorrect :

here is my code :
Ellipse ellipse = new Ellipse(new Rectangle(new Point(-2.3564032448067262, 2.2999188362216954), new Point(2.3564032448067262, -2.3163831258337897)));

Line line = new Line(Point(-1000.0, 0.09999999999999999), Point(1000.0, 0.09999999999999999));
Point[] points = ellipse.getIntersections(line);
// intersection points between line and ellipse :
// P1 : Point(2.3727936609778726, 0.09999999999999999)
// P2 : Point(-2.3727936609778726, 0.09999999999999999)

Line line = new Line(Point(-1000.0, -0.10000000000000002), Point(1000.0, -0.10000000000000002));
Point[] points = ellipse.getIntersections(line);
// intersection points between line and ellipse :
// P1 : Point(2.3727936609778726, -0.10000000000000002)
// P2 : Point(-2.3727936609778726, -0.10000000000000002)

Line line = new Line(Point(-1000.0, -1.5), Point(1000.0, -1.5));
Point[] points = ellipse.getIntersections(line);
// intersection points between line and ellipse :
// P1 : Point(1.812096977199157, -1.5)
// P2 : Point(-1.812096977199157, -1.5)

Line line = new Line(Point(-1000.0, -1.7), Point(1000.0, -1.7));
Point[] points = ellipse.getIntersections(line);
// intersection points between line and ellipse :
// P1 : Point(1.616564239270406, -1.7)
// P2 : Point(-1.616564239270406, -1.7)


here is the corresponding rendering :
https://www.eclipse.org/forums/index.php?t=getfile&id=24579&

When my line has the same Y coordinate as the circle center Y coordinate, the intersection seems to be right, but as you can see on the screenshot when the curvature is more important on the circle the intersection seems to be wrong...

Here is another test case on the top circle area :

Ellipse ellipse = new Ellipse(new Rectangle(new Point(-2.3564032448067262, 2.2999188362216954), new Point(2.3564032448067262, -2.3163831258337897)));

Line line = new Line(Point(-1000.0, 2.0), Point(1000.0, 2.0));
Point[] points = ellipse.getIntersections(line);
// intersection points between line and ellipse :
// P1 : Point(1.2043786907405434, 2.0)
// P2 : Point(-1.2043786907405434, 2.0)

Line line = new Line(Point(-1000.0, 1.8), Point(1000.0, 1.8));
Point[] points = ellipse.getIntersections(line);
// intersection points between line and ellipse :
// P1 : Point(1.4988817347859782, 1.8)
// P2 : Point(-1.4988817347859782, 1.8)

Line line = new Line(Point(-1000.0, 1.6000000000000003), Point(1000.0, 1.6000000000000003));
Point[] points = ellipse.getIntersections(line);
// intersection points between line and ellipse :
// P1 : Point(1.7201636374642788, 1.6000000000000003)
// P2 : Point(-1.7201636374642788, 1.6000000000000003)

Line line = new Line(Point(-1000.0, 1.4000000000000004), Point(1000.0, 1.4000000000000004));
Point[] points = ellipse.getIntersections(line);
// intersection points between line and ellipse :
// P1 : Point(1.8940637489397902, 1.4000000000000004)
// P2 : Point(-1.8940637489397902, 1.4000000000000004)


index.php/fa/24580/0/


I don't know if I am doing something wrong....?
That's why I am giving you my code if you want to test
  • Attachment: in.jpg
    (Size: 36.30KB, Downloaded 591 times)
  • Attachment: in2.jpg
    (Size: 27.20KB, Downloaded 314 times)

[Updated on: Mon, 11 January 2016 14:50]

Report message to a moderator

Re: [GEF4] geometry intersections accuracy [message #1719734 is a reply to message #1719698] Mon, 11 January 2016 17:56 Go to previous messageGo to next message
Alexander Nyssen is currently offline Alexander NyssenFriend
Messages: 244
Registered: July 2009
Location: Lünen
Senior Member
How to you render the geometries you listed above? Could you provide details about how you 'apply' them to JavaFX? Are you using a GeometryNode? What visual properties are set (stroke type, etc.)?
Re: [GEF4] geometry intersections accuracy [message #1719810 is a reply to message #1719734] Tue, 12 January 2016 09:09 Go to previous message
Sylvain Bi is currently offline Sylvain BiFriend
Messages: 10
Registered: May 2015
Junior Member
Yes I'm using GeometryNode :
Stroke width = 0.5
Fill = NULL
Stroke = javafx.scene.paint.Color
Stroke Type = CENTERED
Previous Topic:gef4 removing nodes from a graph does not refresh the viewer
Next Topic:[GEF4] Rendering problems in logo example
Goto Forum:
  


Current Time: Fri Apr 19 04:50:43 GMT 2024

Powered by FUDForum. Page generated in 0.01768 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top