QCAD Bugtracker

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bug Report
  • Category QCAD (main)
  • Assigned To
    Andrew
  • Operating System Windows 7
  • Severity Low
  • Priority Very Low
  • Reported Version Development
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: QCAD Bugtracker
Opened by CVH - 26.10.2021
Last edited by Andrew - 29.10.2021

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

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

Closed by  Andrew
29.10.2021 10:06
Reason for closing:  Fixed
CVH commented on 29.10.2021 05:58

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

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing