# RegionMember not working with negative vertices

I am using RegionMember[] to determine wether a point is within a shape.

shape1 = Cuboid[{0, 0, 0}, {1, 1, 1}]
RegionMember[shape1, {0.5, 0.5, 0.5}]


Returns True, but this doesn't

shape2 = Cuboid[{0, 0, 0}, {1, 1, -1}]
RegionMember[shape2, {0.5, 0.5, -0.5}]


Any ideas on why this is the case, or how to fix. I would like a True returned if the point is within the Cuboid.

• In versions 10.0.1 and 10.4.1 RegionMember[shape2, {0.5, 0.5, -0.5}] generates a message RegionMember::regp: "A correctly specified region expected at position 1 of RegionMember[Cuboid[{0,0,0},{1,1,-1}],{0.5,0.5,-0.5}].", but in versions 11.1.1 and 11.2.0 it doesn't. – Alexey Popkov Jan 12 '18 at 8:06
• @AlexeyPopkov Ah. Now I get it. I also got the message (v 11.0.1) but wondered how this can be overlooked... – Henrik Schumacher Jan 12 '18 at 8:07

## 1 Answer

Try shape2 = Cuboid[{0, 0, -1}, {1, 1, 0}] or Cuboid @@ Transpose[Sort /@ Transpose[{{0, 0, 0}, {1, 1, -1}}]]. Mathematica expects that the entries of the first argument list are all less or equal the respective entries of the second argument list.

• Isn't this assumption unexpected? – Kuba Jan 12 '18 at 7:14
• @Kuba ?Cuboid says Cuboid[Subscript[p, min],Subscript[p, max]] represents an axis-aligned filled cuboid with lower corner Subscript[p, min] and upper corner Subscript[p, max]. I see "min", "max" and "lower corner" and "upper corner", so no, I don't think that this should be considered unexpected. Moreover, the documentation page is also quite detailed about it. Btw: Graphics3D accepts Cuboid[{0, 0, 0}, {1, 1, -1}], but it gets the rendering wrong. – Henrik Schumacher Jan 12 '18 at 8:02
• I know it is for people but for arbitrary ViewVertical, terms lower/upper make not so much sense. p.s. I can't reproduce the problem with rendering, what exactly did you have in mind? – Kuba Jan 12 '18 at 8:08
• @Kuba Since the normals point inwards, the shading is not computed correctly. But maybe this is also version specific? – Henrik Schumacher Jan 12 '18 at 8:10
• @Kuba Getting an error message from Cuboid might be difficult as it was orginally meant merely as a wrapper for Graphics3D. But I am with you that at least RegionMember should tell us that something is going wrong. Actually in v 11.0.1 it does... – Henrik Schumacher Jan 12 '18 at 8:19