Home » Eclipse Projects » GEF » [GEF4] geometry intersections accuracy
[GEF4] geometry intersections accuracy [message #1719698] |
Mon, 11 January 2016 09:38  |
Eclipse User |
|
|
|
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 :

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)

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 627 times)
Attachment: in2.jpg
(Size: 27.20KB, Downloaded 363 times)
[Updated on: Mon, 11 January 2016 09:50] by Moderator
|
|
| | |
Goto Forum:
Current Time: Sat Jul 26 03:57:34 EDT 2025
Powered by FUDForum. Page generated in 0.06128 seconds
|