# DiscretizeGraphics issues with transformations

I noticed DiscretizeGraphics does not work correctly with transformed Graphics such as

Graphics[Rotate[Rectangle[], 30°]]


Both using Rotate and GeometricTransformation together with RotationTransform yield EmptyRegion[2] when DiscretizeGraphics is used.

Graphics[Rotate[Rectangle[], 30°]] // DiscretizeGraphics
(* EmptyRegion[2] *)

GeometricTransformation[Rectangle[],
RotationTransform[30°]]] // Graphics // DiscretizeGraphics
(* EmptyRegion[2] *)


Is this a bug? Is there a workaround?

Here are a four possibilities. Two of them are due to @JM's comments. (Thanks!) All of them are based on the fact that Rectangle[] can be used as a geometric region as well as a graphics primitive, and they all use TransformedRegion to get the rotation rather than GeometricTransformation, RotationTransform or Rotate.

Define the rotated rectangle as a region:

reg = TransformedRegion[Rectangle[], RotationTransform[π/6]]

(* Parallelogram[{0, 0}, {{-(1/2), Sqrt[3]/2}, {Sqrt[3]/2, 1/2}}] *)


Then we can do

GraphicsRow[
Through[{DiscretizeRegion, DiscretizeGraphics,
BoundaryDiscretizeRegion, BoundaryDiscretizeGraphics}@reg]
]


• BoundaryDiscretizeRegion[] and BoundaryDiscretizeGraphics[] can be used here too, of course. – J. M. is in limbo Nov 1 '17 at 14:52
• @J.M. Thanks for that. I've updated the answer. – aardvark2012 Nov 1 '17 at 23:31

For the time being a workaround is using first DiscretizeGraphics and then transforming the region e.g.

Rectangle[] // DiscretizeGraphics //TransformedRegion[#, RotationTransform[30°]]&