Group Abstract Group Abstract

Message Boards Message Boards

0
|
529 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Unexpected results during 2D regions basic Boolean manipulation

Posted 2 months ago
POSTED BY: Kirill Vasin
3 Replies

Indeed. This also works:

outer = RegionDifference[DiscretizeRegion@Region@Rectangle[{-1, -1}, {1, 1}], 

   RegionUnion[DiscretizeRegion@Region@Rectangle[{-0.9, -0.9}, {0.9, -0.4}], 
    DiscretizeRegion@Region@Rectangle[{0.4, -0.9}, {0.9, 0.4}]]]
POSTED BY: Kirill Vasin

If it is rationalized it start to work properly.

Interesting! And DiscretizeRegion[] seems to be annother way to make it work, e.g.:

outer = RegionDifference[Rectangle[{-1, -1}, {1, 1}], 
  DiscretizeRegion@
   RegionUnion[Rectangle[{-0.9, -0.9}, {0.9, -0.4}], 
    Rectangle[{0.4, -0.9}, {0.9, 0.4}]]]
POSTED BY: Henrik Schachner

This is bug considering this answer on stackexchange.

outer = RegionDifference[
  Rectangle[{-1, -1}, {1, 1}],
  RegionUnion[
    Rectangle[{-0.9, -0.9}, {0.9, -0.4}],
    Rectangle[{0.4, -0.9}, {0.9, 0.4}]
  ]
];
RegionPlot[Rationalize[outer, 0]]

If it is rationalized it start to work properly.

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