← All bug reports

FS#2303Arc/Circle/Ellipse area (IC) exception for CW ellipse Arc segment > 180°

Type
Bug
Status
Closed
Resolution
Fixed
Category
QCAD (main)
Severity
Low
Priority
Low
Reported version
Development
Operating system
Windows 7
Reported
2021-10-26 by CVH
Closed
2021-10-29 by andrew

Windows 7 pro 32 bit msi-Installer
Version: 3.26.4.5 (3.26.4.5)
Internet: QCAD.org
Build Date: Jul 20 2021
Revision: e596276
Qt Version: 5.13.2
Architecture: i386
Compiler: Unknown

Andrew,

With an CW ellipse Arc > 180° the GUI method info Arc/Circle/Ellipse (IC) in segment mode throws an exception:
Uncaught exception at :scripts/Information/InfoArcCircleArea/InfoArcCircleArea.js:210: ReferenceError: Can't find variable: remainSectorArea

Rather a complex way to get the area of an ellipse arc segment.

There: area = majorR * minorR / 2 * (sweep - Math.sin(sweep)).
- where majorR, minorR & sweep can simply be sourced from the ellipse arc shape/entity.
- where the area is signed ... +CCW, -CW

About identical as for an arc segment.

For an (ellipse) arc sector one would only need to add/subtract
the area of triangle |StartP-CenterP-EndP|

Regards,
CVH

Comments (1)

CVH 2021-10-29

Andrew,
Have seen the commit with removal.

I would propose two new ellipse methods aka the arc methods.

ellipse.getArea() for ellipse sectors.
= 0 for (about) zero sweep
= majorR * minorR * Math.PI for absolute sweeps of 2PI or over
= majorR * minorR / 2 * sweep

ellipse.getChordArea() for ellipse segments.
= 0 for (about) zero sweep
= majorR * minorR * Math.PI for absolute sweeps of 2PI or over
= majorR * minorR / 2 * (sweep - Math.sin(sweep))

In all QCAD doesn't allow for majorR or minorR equal to zero (A line back and forth)

With these methods:
The (signed) area of an arc or ellipse arc sector is shape.getArea().
And that of segments would be shape.getChordArea().
Even functional for full ellipses.
Pitty arc methods return the absolute area. (For centroids that is)

What would simplify the InfoArcCircleArea.js a lot depending the mode.
I have closed format ellipse and arc centroid equations too.

Been working on a Centroids Addon for any shape as uniform density area (including total hatched area) or as uniform wire. ;-)

Regards,
CVH