Calculate Polyline area RPolyline::getArea() FS#1756

Please use this forum to post feedback and suggestions related to QCAD.

Moderator: andrew

Post Reply
CVH
Active Member
Posts: 40
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Calculate Polyline area RPolyline::getArea() FS#1756

Post by CVH » Sat May 19, 2018 8:10 pm

Andrew,

because you did not answer if it is ok to continue to comment on a closed bug report (FS#1756) please read my findings in the included pdf.

Included: Properly formated text as pdf
Included: Self-crossing arc segments of polys: pic 1
Included: Disambiguous nature of the oriëntation: pic 2
Included: Snapshot RPolyline::getArea()

I hope you can wade your way through my post.
I would be happy to precheck your adapted coding, just send the part to me in plain text.

Implementation in a QCAD release would be of great benefit to me for the study of a better method to asymmetrically scale polys with arcs.
Or you could sent me a pre-path like once before.

Regards
Attachments
RPolyline_Snapshot.txt
(2.28 KiB) Downloaded 23 times
QCAD Greens 2.png
QCAD Greens 2.png (17.08 KiB) Viewed 587 times
QCAD Greens 1.png
QCAD Greens 1.png (3.52 KiB) Viewed 587 times
QCAD Greens.pdf
(211.56 KiB) Downloaded 24 times

CVH
Active Member
Posts: 40
Joined: Wed Sep 27, 2017 4:17 pm
Location: Belgium; Antwerp

Re: Calculate Polyline area RPolyline::getArea() FS#1756

Post by CVH » Sun May 20, 2018 11:25 am

Murphy's law
“Anything that can go wrong, will”

Shamefully I admid I introduced a double fault, in fact a multi double fault.
Please use the revision of QCAD Greens document.

Correction: add areaC to areaP.

[attachment=0]QCAD Greens v2.pdf[/attachment]


Proof: mental exercise:
With chordArea always positive by definition.
Depending on the oriëntation of the base polygon:
- CCW base polygon, enclosed area left side, Green's theorem positive:
- bulge positive, right side, increase area, add chordArea to positive.
- bulge negative, left side, decrease area, substract chordArea from positive.
- CW base polygon, enclosed area right side, Green's theorem negative:
- bulge positive, right side, decrease area, add chordArea to negative.
- bulge negative, left side, increase area, substract chordArea from negative.

=> Disregarding the oriëntation the chordArea has the sign of the bulge.
=> The summed signed chordArea's are added to the signed Green's theorem area.
=> The total area is the absolute.


Where did this got wrong...
All starts with:

Misc/Script Examples/'Import/Export'/Dump Polyline script.
viewtopic.php?f=8&t=5566
CVH wrote:
Q: Why x from RVector and y from minus RVector? Why .arg(-v.y)?
A: The scripts in Misc > Examples are not meant for production use but are various examples that might or might not be useful. At one point I needed

a script the dumps polylines for use in a pixel based coordinate system with the origin at the top left.
I'd recommend to create your own script based on that and make changes as needed.

Tried but was not able to. No matter what I do the output was blank.
So I made a transform function importing the Command History text to my worksheets.
Meanwhile formatting the numbers to local. (viewtopic.php?f=8&t=5589)

Sometimes the reported oriëntaion was of.
In the 'Dump Polyline script' the method for that is less elaborate then what the QCAD core uses.
And the 'Dump Polyline script' reverses the polyline according to that.
Also this was patched.

Furthermore (-v.y) is mirroring and reverses the oriëntation.

I ended up with a lot of negations.
Ceaning this up for further use with the skewing topic I found I had to sum the sums and not distract them.

Regards
Attachments
QCAD Greens v2.pdf
(320 KiB) Downloaded 22 times

Post Reply

Return to “QCAD Suggestions and Feedback”