QCAD Bugtracker

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bug Report
  • Category QCAD (main)
  • Assigned To
    Andrew
  • Operating System All
  • Severity Low
  • Priority Very Low
  • Reported Version 3.21.2
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: QCAD Bugtracker
Opened by Lev Golod - 16.07.2018
Last edited by Andrew - 16.07.2018

FS#1783 - RArc::splitAt(): fails in some cases

RArc::splitAt() works wrong in some cases.
To reproduce execute this script:

            var arc = new RArc(new RVector(0, 0), 100, Math.PI*2, Math.PI/2, true);
            var points = [];
            points.push(arc.getPointAtPercent(1/3));
            var arcs = arc.splitAt(points);
            if (arcs.length == 2) {
                qDebug("OK, arcs count:", arcs.length);
            } else {
                qDebug("FAILED, arcs count:", arcs.length);
            }

            arc.mirror(new RLine(0, 0, 0, 100));

            points = [];
            points.push(arc.getPointAtPercent(1/3));
            arcs = arc.splitAt(points);
            if (arcs.length == 2) {
                qDebug("OK, arcs count:", arcs.length);
            } else {
                qDebug("FAILED, arcs count:", arcs.length);
            }

The first case split in two arcs, but the second splits in one arc only.

I think the reason is the code in RArc::splitAt():

        ...
        if (RMath::getAngleDifference180(a1, a2))*radius()<0.001) {
            continue;
        }
        ...

The RMath::getAngleDifference180() return angle between -pi and pi so absolute value should be used.

Closed by  Andrew
16.07.2018 15:00
Reason for closing:  Fixed
Additional comments about closing:  

https://github.com/qcad/qcad/commit /6835a4f7a1613805a8d50665d2cfdb8a715dace 2

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing