QCAD Bugtracker

QCAD - 2D CAD System.

Click here for a documentation of the DokuWiki formatting syntax that can be used in reports

Please search for existing tasks (also closed ones) before opening a new task.

Please make sure that you are using the latest Version of QCAD before posting a bug (menu Help > Check for Updates)

IDCategoryTask Type  ascSeveritySummaryStatusProgress
2564ECMAScriptBug ReportLowREllipse::getVectorTo(p) returns a vector to a major po...Assigned
0%
Task Description

Andrew,

If a given point p is on the major axis then REllipse::getVectorTo(p) returns one of the major points. In the code this is handled as a special case when the point is in-line (collinear) with the major axis.
This is only correct for points p outside the ellipse.
Or better: For points p outside the area between the focal points.

The correct solutions are:
- if p equals the center ⇒ two vectors to the two minor points.
- if p equals one of the major points ⇒ the major point itself.
- if p is in between the focal points ⇒ two vectors mirrored over the major axis.
- if p is on the unlimited axis but outside the focal points ⇒ the nearest major point.

The problem is now what to return on a duality with full ellipses.
Or for an ellipse arc where two results are valid.

For example:
RCircle::getVectorTo(p) returns an invalid vector when the point is near the center.
Then there are an unlimited number of solutions.



Further discovered that the point related to the returned vector may fail x²/a²+y²/b²=1
Although almost on the ellipse within 2.299e-10 ... f(x,y) may return 9.5310
This example would fail REllipse::contains while the border is considered as inside.

Meanwhile implemented a ‘simple method’ to find the nearest point(s) on an ellipse.
Fast converging in 3 steps, no trigs and very accurate, about 24 lines of code.
f(x,y) returns mostly 1.000 with so far:
- a minimum of 0.9999999999999997
- a maximum of 1.0000000000000007.
In other words, it is only off for the last meaningful decimal digit.

With this all methods that are based on REllipse::getVectorTo(p) can be implemented very reliable with tolerance, border flag, ... and so on.
By default the normal for a point is given with high accuracy and a tangent is that rotated.
...
..
.

Regards,
CVH


	
Showing tasks 1 - 1 of 1 Page 1 of 1

Available keyboard shortcuts

Tasklist

Task Details

Task Editing