3
$\begingroup$
RegionMember[RegionBoundary[Cuboid[]]]

Works, but

RegionMember[RegionBoundary[RegionDifference[Cuboid[], Ball[]]]]

Returns nothing, even though the region RegionBoundary[RegionDifference[Cuboid[], Ball[]]] is a Region[]

RegionQ[RegionBoundary[RegionDifference[Cuboid[], Ball[]]]]
(* True *) 

And it even RegionBoundary[RegionDifference[Cuboid[], Ball[]]] looks like a region!

Region[RegionBoundary[RegionDifference[Cuboid[], Ball[]]]]

enter image description here

$\endgroup$
12
  • $\begingroup$ Region[RegionBoundary[RegionDifference[Cuboid[], Ball[]]]] works for me. Is your syntax RegionMember[RegionUnion[RegionBoundary[RegionDifference[Cuboid[], Ball[]]]]] correct? $\endgroup$
    – user64494
    Commented May 19, 2020 at 16:05
  • $\begingroup$ Try finding the RegionMemberFunction[] of it by using RegionMember[] - that seems to be issue...I noticed the title was misleading - so I have edited it. $\endgroup$
    – Tomi
    Commented May 19, 2020 at 16:06
  • $\begingroup$ Seems like a bug to me. RegionMember should not be returning {}. $\endgroup$
    – Greg Hurst
    Commented May 19, 2020 at 16:18
  • $\begingroup$ I mean RegionUnion[RegionBoundary[RegionDifference[Cuboid[], Ball[]]]]. Hope I am clear. $\endgroup$
    – user64494
    Commented May 19, 2020 at 16:23
  • $\begingroup$ (And btw you don't need to use RegionUnion on one argument.) $\endgroup$
    – Greg Hurst
    Commented May 19, 2020 at 16:23

2 Answers 2

4
$\begingroup$

We can find a workaround for semialgebraic regions through CylindricalDecomposition.

regionBoundary[reg_?RegionQ] := 
  Module[{x,y,z},
    ImplicitRegion[
      CylindricalDecomposition[RegionMember[reg, {x, y, z}], {x, y, z}, "Boundary"], 
      {x, y, z}
    ]
  ]

RegionMember[regionBoundary[RegionDifference[Cuboid[], Ball[]]]] // Head
RegionMemberFunction
$\endgroup$
3
$\begingroup$

Not really a solution, but a work around is to wrap the shapes in BoundaryDiscretizeRegion[]:

RegionMember[RegionDifference[BoundaryDiscretizeRegion[Cuboid[]], BoundaryDiscretizeRegion[Ball[]]]]

Returns a RegionMemberFunction

$\endgroup$
1
  • $\begingroup$ Also RegionMember[ RegionDifference[BoundaryDiscretizeRegion[Cuboid[]], BoundaryDiscretizeRegion[Ball[]]], {1, 2, 3.1}] performs False. $\endgroup$
    – user64494
    Commented May 19, 2020 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.