Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I was experimenting with the code from this question when I ran into another problem with regions.

Ω = RegionDifference[Rectangle[{0, 0}, {10, 10}], Rectangle[{4, 4}, {8, 8}]];
RegionPlot[Ω]

plot

Ω1 = TransformedRegion[Ω, RotationTransform[45 °, {5, 5}]];
RegionQ[Ω1]
True
RegionPlot[Ω1]

RegionPlot::invplotreg: TransformedRegion[RegionDifference[Rectangle[{0, 0}, {10, 10}], Rectangle[{4, 4}, {8, 8}]], TransformationFunction[...]] is not a valid region to plot. >>

What is the difference between a "valid region to plot" and a region that satisfies RegionQ? Or, perhaps, to put it better, am I seeing a bug in RegionPlot or just an incomplete implementation?

I note that

RegionPlot[TransformedRegion[Rectangle[], RotationTransform[45 °, {.5, .5}]], 
  PlotRange -> All]

works as expected, so it would seem RegionPlot can handle rotations for some class of inputs.

share|improve this question
    
I can reproduce this. Might try tracing it some time later (for testing my tracer :) –  Silvia Jul 19 at 12:27
2  
For me even the first basic example in the TransformedRegion documentation doesn't work properly. And the second example hangs the kernel... –  Simon Woods Jul 19 at 13:24
    
@SimonWoods For the first example, looks like it can use a PlotRange -> All. (+1) –  Silvia Jul 19 at 16:47
1  
@SimonWoods, if you could send this and your OS version to the support that would be useful to track it down. Thanks. I have filed fact that an expr with Head TransformedRegion does not work as a suggestion for improvement. –  user21 Jul 21 at 8:51
1  
@user21. re: "an expr with Head TransformedRegion does not work." I don't think that is the issue since TransformedRegion[Rectangle[], RotationTransform[45 °, {.5, .5}]] has head TransformedRegion, but can be plotted by RegionPlot. –  m_goldberg Jul 21 at 9:07

1 Answer 1

up vote 6 down vote accepted

Here is a workaround:

r1 = RegionDifference[Rectangle[{0, 0}, {10, 10}], 
   Rectangle[{4, 4}, {8, 8}]];
r2 = TransformedRegion[r1, RotationTransform[45 \[Degree], {5, 5}]];
mr = DiscretizeRegion[r2]

enter image description here

And then:

RegionPlot[mr]

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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