Message Boards Message Boards

0
|
1383 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Possible issue with RegionCentroid function

Posted 11 months ago

I've noticed a possible issue with the RegionCentroid function and am hoping someone can help.

The issue came to light while calculating the centroid coordinates for a 3D region comprising the union of seven separate cylinders and is highlighted in the attached notebook.

With reference to the notebook, what I've found is that the y-coordinate of the RegionCentroid for the cylinder region differs quite noticeably when compared to the RegionCentroid y-coordinate for an ostensibly equivalent 2D region comprising the union of seven disks, with each disk having the same centre coordinates and radius as the cylinders.

Any advice/suggestions would be much appreciated.

I should add that the centroid of the 2D region looks correct, but the centroid of the 3D region seems to lack precision in the y-coordinate (the x- and z-centroid values appear to be OK).

Attachments:
POSTED BY: Ian Williams

I think I've (partly) answered my own question. And thought my findings worth sharing. With a bit of trial and error, I've found that if I prescribe all dimensions used to define my Regions as integer values (by converting the length units from meters to millimeters and rounding) the low precision in the returned RegionCentroid values for my 3D region is eliminated and the 3D centroid xy coordinates match those of the equivalent 2D region (see attached notebook).

I have to say, the low precision given by RegionCentroid for my relatively simple 3D region comprising just 7 cylinders is a little surprising and doesn't instill confidence that RegionCentroid can be relied upon when applied to more complex 3D regions in which the geometry is defined by real numbers. I wonder whether there's a bug or whether there's scope for refinement of the RegionCentroid function?

POSTED BY: Ian Williams
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract