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}]];


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

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.

  • $\begingroup$ I can reproduce this. Might try tracing it some time later (for testing my tracer :) $\endgroup$ – Silvia Jul 19 '14 at 12:27
  • 3
    $\begingroup$ For me even the first basic example in the TransformedRegion documentation doesn't work properly. And the second example hangs the kernel... $\endgroup$ – Simon Woods Jul 19 '14 at 13:24
  • $\begingroup$ @SimonWoods For the first example, looks like it can use a PlotRange -> All. (+1) $\endgroup$ – Silvia Jul 19 '14 at 16:47
  • 1
    $\begingroup$ @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. $\endgroup$ – user21 Jul 21 '14 at 8:51
  • 1
    $\begingroup$ @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. $\endgroup$ – m_goldberg Jul 21 '14 at 9:07

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:


enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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