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)

ID  descCategoryTask TypeSeveritySummaryStatusProgress
2565QCAD (main)Bug ReportVery LowNaN length for arbitrary ellipse arcAssigned
0%
Task Description

Andrew,

Probably not OS or QCAD version related.

The ellipse arc in the example file is drawn CCW and then the start parameter was set to 180. (All part of a test of newer code for the nearest point on an ellipse)
Its end parameter was originally 44.56263613...

If we reload this file its properties are:
- Not reversed (CCW)
- ratio is 0.42307692...
- Parameters are 180 & 404.56263613...
- The reported length is about 1993.21829743...

To replicate the issue you must draw over this ellipse shape:
- EA ; Direction CCW
- SR for snapping to references.
- Indicate the major, minor, start and end point all by snapping to the original references.

You now have a copy of the provided ellipse shape.
Select it with Alt-Select, it is the one without a length.

Properties are:
- Not reversed (CCW)
- ratio is 0.42307692...
- Parameters are 180 & 44.56263613...
- The reported length is NaN

I can replicate that for some other CCW ellipse arcs ...
... Perhaps given that the start parameter is 180 degrees.
Also suspecting that it can be replicated for CW arcs.

For the record:
A 2D wire Centroid for this shape also fails.
Simply because it tests for the length reported by QCAD.
It doesn’t start to approximate something that is about zero long.

Regards,
CVH

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 - 2 of 2 Page 1 of 1

Available keyboard shortcuts

Tasklist

Task Details

Task Editing