Skip to main content



      Home
Home » Eclipse Projects » GEF » [GEF4] geometry intersections accuracy
[GEF4] geometry intersections accuracy [message #1719698] Mon, 11 January 2016 09:38 Go to next message
Eclipse UserFriend
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 626 times)
  • Attachment: in2.jpg
    (Size: 27.20KB, Downloaded 361 times)

[Updated on: Mon, 11 January 2016 09:50] by Moderator

Re: [GEF4] geometry intersections accuracy [message #1719734 is a reply to message #1719698] Mon, 11 January 2016 12:56 Go to previous messageGo to next message
Eclipse UserFriend
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 04:09 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 22:04:42 EDT 2025

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

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

Back to the top