Group Abstract Group Abstract

Message Boards Message Boards

2
|
5.3K Views
|
2 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Avoid warning while using RegionCentroid?

Posted 9 years ago

Encountered a warning when using RegionCentroid for shapes like the following:

enter image description here

The warning is

(*RegionCentroid::reg: Hexahedron[{{10.,10.,40.},{10.,20.,40.},{10.,15.33,50.},{10.,10.,50.},{30.,10.,40.},{30.,20.,40.},{30.,15.33,50.}, 
{30.,10.,50.}}] is not a correctly specified region.*)  

Note the 15.33 in the 4th and 7th vertex. When using a lower precision number, e.g. using 15.3, a warning is not returned. Is there an option to pass to RegionCentroid that would allow it return a result for the higher precision number (e.g. 15.33 ) ?

Below is the code

g2 = Hexahedron[{{10., 10., 40.}, {10., 20., 40.}, {10., 15.33, 50.}, {10., 10., 50.}, {30., 10., 40.}, {30., 20., 40.}, {30., 15.33, 50.}, {30., 10., 50.}}];
g1 = Hexahedron[{{10., 10., 40.}, {10., 20., 40.}, {10., 15.3, 50.}, {10., 10., 50.}, {30., 10., 40.}, {30., 20., 40.}, {30.,15.3, 50.}, {30., 10., 50.}}];
g0 = Hexahedron[{{10., 10., 40.}, {10., 20., 40.}, {10., 15., 50.}, {10., 10., 50.}, {30., 10., 40.}, {30., 20., 40.}, {30., 15., 50.}, {30., 10., 50.}}];
RegionCentroid[g2]
RegionCentroid[g1]
RegionCentroid[g0]
Graphics3D[{g2}]
Attachments:
POSTED BY: Robert McHugh
2 Replies

Very strange error, must be related to some error-checking that is incorrect:

Reap[
    Do[
        Quiet@Check[
            RegionCentroid[Hexahedron[{{10.,10.,40.},{10.,20.,40.},{10.,a,50.},{10.,10.,50.},{30.,10.,40.},{30.,20.,40.},{30.,a,50.},{30.,10.,50.}}]
        ],Sow[a]
    ]
    ,
    {a,12,18,0.01}
    ]
][[2,1]]

gives back: {12.01,12.02,12.03,12.04,12.06,12.07,12.08,12.09,12.11,12.12,12.13,12.14,12.16,12.17,12.18,12.19,12.21,12.22,12.23,12.24,12.26,12.27,12.28,12.29,12.31,12.32,12.33,12.34,12.36,12.37,12.38,12.39,12.41,12.42,12.43,12.44,12.46,12.47,12.48,12.49,12.51,12.52,12.53,12.54,12.56,12.57,12.58,12.59,12.61,12.62,12.63,12.64,12.66,12.67,12.68,12.69,12.71,12.72,12.73,12.74,12.76,12.77,12.78,12.79,12.81,12.82,12.83,12.84,12.86,12.87,12.88,12.89,12.91,12.92,12.93,12.94,12.96,12.97,12.98,12.99,13.01,13.02,13.03,13.04,13.06,13.07,13.08,13.09,13.11,13.12,13.13,13.14,13.16,13.17,13.18,13.19,13.21,13.22,13.23,13.24,13.26,13.27,13.28,13.29,13.31,13.32,13.33,13.34,13.36,13.37,13.38,13.39,13.41,13.42,13.43,13.44,13.46,13.47,13.48,13.49,13.51,13.52,13.53,13.54,13.56,13.57,13.58,13.59,13.61,13.62,13.63,13.64,13.66,13.67,13.68,13.69,13.71,13.72,13.73,13.74,13.76,13.77,13.78,13.79,13.81,13.82,13.83,13.84,13.86,13.87,13.88,13.89,13.91,13.92,13.93,13.94,13.96,13.97,13.98,13.99,14.01,14.02,14.03,14.04,14.06,14.07,14.08,14.09,14.11,14.12,14.13,14.14,14.16,14.17,14.18,14.19,14.21,14.22,14.23,14.24,14.26,14.27,14.28,14.29,14.31,14.32,14.33,14.34,14.36,14.37,14.38,14.39,14.41,14.42,14.43,14.44,14.46,14.47,14.48,14.49,14.51,14.52,14.53,14.54,14.56,14.57,14.58,14.59,14.61,14.62,14.63,14.64,14.66,14.67,14.68,14.69,14.71,14.72,14.73,14.74,14.76,14.77,14.78,14.79,14.81,14.82,14.83,14.84,14.86,14.87,14.88,14.89,14.91,14.92,14.93,14.94,14.96,14.97,14.98,14.99,15.01,15.02,15.03,15.04,15.06,15.07,15.08,15.09,15.11,15.12,15.13,15.14,15.16,15.17,15.18,15.19,15.21,15.22,15.23,15.24,15.26,15.27,15.28,15.29,15.31,15.32,15.33,15.34,15.36,15.37,15.38,15.39,15.41,15.42,15.43,15.44,15.46,15.47,15.48,15.49,15.51,15.52,15.53,15.54,15.56,15.57,15.58,15.59,15.61,15.62,15.63,15.64,15.66,15.67,15.68,15.69,15.71,15.72,15.73,15.74,15.76,15.77,15.78,15.79,15.81,15.82,15.83,15.84,15.86,15.87,15.88,15.89,15.91,15.92,15.93,15.94,15.96,15.97,15.98,15.99,16.01,16.02,16.03,16.04,16.06,16.07,16.08,16.09,16.1,16.11,16.12,16.13,16.14,16.15,16.16,16.17,16.18,16.19,16.21,16.22,16.23,16.24,16.26,16.27,16.28,16.29,16.31,16.32,16.33,16.34,16.35,16.36,16.37,16.38,16.39,16.4,16.41,16.42,16.43,16.44,16.46,16.47,16.48,16.49,16.51,16.52,16.53,16.54,16.56,16.57,16.58,16.59,16.6,16.61,16.62,16.63,16.64,16.65,16.66,16.67,16.68,16.69,16.71,16.72,16.73,16.74,16.76,16.77,16.78,16.79,16.81,16.82,16.83,16.84,16.85,16.86,16.87,16.88,16.89,16.9,16.91,16.92,16.93,16.94,16.96,16.97,16.98,16.99,17.01,17.02,17.03,17.04,17.06,17.07,17.08,17.09,17.1,17.11,17.12,17.13,17.14,17.15,17.16,17.17,17.18,17.19,17.21,17.22,17.23,17.24,17.26,17.27,17.28,17.29,17.31,17.32,17.33,17.34,17.35,17.36,17.37,17.38,17.39,17.4,17.41,17.42,17.43,17.44,17.46,17.47,17.48,17.49,17.51,17.52,17.53,17.54,17.56,17.57,17.58,17.59,17.6,17.61,17.62,17.63,17.64,17.65,17.66,17.67,17.68,17.69,17.71,17.72,17.73,17.74,17.76,17.77,17.78,17.79,17.81,17.82,17.83,17.84,17.85,17.86,17.87,17.88,17.89,17.9,17.91,17.92,17.93,17.94,17.96,17.97,17.98,17.99}

Those do not work out. The complement of that (the ones who do work) is:

NumberLinePlot[Complement[Range[12, 18, 0.01], %]]

enter image description here

(tested on Version 11.0.1 Mac OSX)

I will submit this as product feedback on https://www.wolfram.com/support/contact/email/

POSTED BY: Sander Huisman

Can be track under: [CASE:3828560]. If there is any follow-up I will post it here.

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