Hi Everyone
I'm getting inconsistent results measuring area. You can see in my file I have a circle, a circle with 1/4 missing and a circle with one quarter squared off. All the measurements I recorded came from the area field on the property editor. Here are the results I am getting.
The full circle works fine. The area is pi.
The circle with 1/4 missing has a larger area than the full circle. This cannot be correct.
The circle with one corner squared off has the correct area. The number is the exact same as the circle with 1/4 missing.
The area of the hatched shapes is correct or at least very close. I would guess these readings are off slightly due to an approximation of the arc.
Any help would be appreciated. Thanks.
Windows 10 64 bit
QCAD Pro version: 3.27.8.0
area measurement incorrect
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
-
CVH
- Premier Member
- Posts: 5097
- Joined: Wed Sep 27, 2017 4:17 pm
Re: area measurement incorrect
Hi, and welcome to the QCAD forum.
A circle with radius 1 has an enclosed area of Pi*r² = 3.14159265...
Then 3/4 of a circle or an arc sector has an enclosed area of 2.35619449... Not at all 2.35227962
Adding a square with sides of 1, with an area of 1 results in 3.35619449...
I can not replicate the Hatched area = 3.35227962 for both rightmost cases.
Both are reported to have an area of 3.35619449 (Rounded to 8 digits) on my system.
Only correct for the top example as Hatch!
Luckily the 2D Area Centroid (Misc .. Information .. 2D Centroids) methods reports the correct answer.
I wouldn't have expected otherwise.
Select the Centroid marker and see its custom properties for values in full floating point notation.
Not utterly 3/4Pi and 3/4Pi+1 because your 3/4 circle sectors are slightly malformed.
Top middle we expect angles between segments: 90, 180, 180
Top bottom: 90, 90, 270
The difference is 4e-8 in both cases.
Negligible but it has a minute impact on the results in full floating point.
- - - - - - - - -
Before, areas of polylines including bulging segments were calculated as the area of the polygon based on the nodes.
Bulging out or inwards was not accounted for. (3.15.2.2 - v3.20.1.6)
Prior (>3.13.0) and afterwards is was by segmentation.
After I released Centroids I also explained in detail how my tools did the trick correctly.
-> As polygon, adding OR subtracting each arc segment area based on the bulge factor and chord length.
Perhaps it was not implemented with the same great care for details by Andrew.
Initially for Polylines (No exact details) and later for Hatches (>3.27.7).
Remark that the Polyline swaps orientation (CW<>CCW) with bulge +/-2.41421356 or without (=0 -> triangle)
Both are QCAD Pro resources, proprietary code that can not be verified by us simple users.
Some minute error can be expected because of the naive summation algorithm.
Centroids exploit a second-order compensation for summing (long) chains of values.
Your best option is to file a bug report on QCAD Bugtracker.
Regards,
CVH
A circle with radius 1 has an enclosed area of Pi*r² = 3.14159265...
Then 3/4 of a circle or an arc sector has an enclosed area of 2.35619449... Not at all 2.35227962
Adding a square with sides of 1, with an area of 1 results in 3.35619449...
I can not replicate the Hatched area = 3.35227962 for both rightmost cases.
Both are reported to have an area of 3.35619449 (Rounded to 8 digits) on my system.
Only correct for the top example as Hatch!
Luckily the 2D Area Centroid (Misc .. Information .. 2D Centroids) methods reports the correct answer.
I wouldn't have expected otherwise.
Select the Centroid marker and see its custom properties for values in full floating point notation.
Top middle we expect angles between segments: 90, 180, 180
Top bottom: 90, 90, 270
The difference is 4e-8 in both cases.
Negligible but it has a minute impact on the results in full floating point.
- - - - - - - - -
Before, areas of polylines including bulging segments were calculated as the area of the polygon based on the nodes.
Bulging out or inwards was not accounted for. (3.15.2.2 - v3.20.1.6)
Prior (>3.13.0) and afterwards is was by segmentation.
After I released Centroids I also explained in detail how my tools did the trick correctly.
-> As polygon, adding OR subtracting each arc segment area based on the bulge factor and chord length.
Perhaps it was not implemented with the same great care for details by Andrew.
Initially for Polylines (No exact details) and later for Hatches (>3.27.7).
Both are QCAD Pro resources, proprietary code that can not be verified by us simple users.
Some minute error can be expected because of the naive summation algorithm.
Centroids exploit a second-order compensation for summing (long) chains of values.
Your best option is to file a bug report on QCAD Bugtracker.
Regards,
CVH
-
JonW
- Registered Member
- Posts: 2
- Joined: Sun Dec 05, 2021 1:59 am
Re: area measurement incorrect
Thanks for the thorough response. I hope this issue gets fixed. It got me good the other day. No real harm done, I just have a small bold spot from a long night of head scratching. Now I know I have another tool in the toolbox, the "2d Area Centroid" command does work well.
-
CVH
- Premier Member
- Posts: 5097
- Joined: Wed Sep 27, 2017 4:17 pm
Re: area measurement incorrect
Thanks, the Centroids tools were coded with great care for details.
I didn't expect them to fail and these examples confirm that again.
At some point they fall back on approximations and that is stated in the result.
I assume that the devil sits in the orientation of the polyline and that of the base polygon.
Top middle is CW for the polyline and the triangle when all bulge factors are zero.
Bottom middle reverses in orientation when we set the bulge factors to zero.
It should not make any difference ... Adding signed bulging areas to signed polygon areas.
The Shoelace Algorithm will return a negative value when the polyline as polygon was CW.
Bulging outwards = larger = a negative bulge factor and thus a negative arc segment area, the sum would be a larger negative value.
In the end a negative result only means that it was CW, the answer is the absolute of the final area.
No other assumptions should be made for signs in the process of summing.
The issue can be replicated for shapes that swap orientation because of bulging.
The Hatched area is nothing more than the enclosed area of the boundary (ies) as polyline.
I also verified the differential hatched area with your middle shapes as holes.
Orientation is then the key for the sign of the area values, for what to subtract from what.
Then the area property of a hatch fails again ... Differential hatched area by Centroids is correct.
Please file a bug report.
Regards,
CVH
I didn't expect them to fail and these examples confirm that again.
At some point they fall back on approximations and that is stated in the result.
I assume that the devil sits in the orientation of the polyline and that of the base polygon.
Top middle is CW for the polyline and the triangle when all bulge factors are zero.
Bottom middle reverses in orientation when we set the bulge factors to zero.
It should not make any difference ... Adding signed bulging areas to signed polygon areas.
The Shoelace Algorithm will return a negative value when the polyline as polygon was CW.
Bulging outwards = larger = a negative bulge factor and thus a negative arc segment area, the sum would be a larger negative value.
In the end a negative result only means that it was CW, the answer is the absolute of the final area.
No other assumptions should be made for signs in the process of summing.
The issue can be replicated for shapes that swap orientation because of bulging.
The Hatched area is nothing more than the enclosed area of the boundary (ies) as polyline.
I also verified the differential hatched area with your middle shapes as holes.
Orientation is then the key for the sign of the area values, for what to subtract from what.
Then the area property of a hatch fails again ... Differential hatched area by Centroids is correct.
Please file a bug report.
Regards,
CVH
- andrew
- Site Admin
- Posts: 8847
- Joined: Fri Mar 30, 2007 6:07 am