2
$\begingroup$

Seems like this simply rectangle rescale should work and return the exact coordinates of the transformed resulting rectangle (which should be Rectangle[{0.25, 0.25}, {0.75, 0.75}]):

Normal@GeometricTransformation[Rectangle[{0, 0}, {1, 1}], 
  ScalingTransform[{.5, .5}, {.5, .5}]]

Now, this roundabout works:

TransformedRegion[DiscretizeGraphics@Graphics[Rectangle[{0, 0}, {1, 1}]], 
  ScalingTransform[{.5, .5}, {.5, .5}]] // BoundingRegion

(*returns Cuboid[{0.25, 0.25}, {0.75, 0.75}]*)

but weirdly this doesn't:

DiscretizeGraphics@Graphics[{GeometricTransformation[Rectangle[{0, 0}, {1, 1}], 
    ScalingTransform[{.5, .5}, {.5, .5}]]}]
(* returns EmptyRegion[2]*)
$\endgroup$
5
  • $\begingroup$ Why not use TransformedRegion[Rectangle[{0, 0}, {1, 1}], ScalingTransform[{.5, .5}, {.5, .5}]] instead? $\endgroup$ – Carl Woll Dec 20 '17 at 21:45
  • $\begingroup$ @CarlWoll Good point, I think I tried that and it may work but I'd like the result to be a Rectangle object, and I'd also like to understand why this other usage fails. $\endgroup$ – M.R. Dec 20 '17 at 21:47
  • $\begingroup$ Then your question is probably a duplicate of mathematica.stackexchange.com/q/11430/45431. $\endgroup$ – Carl Woll Dec 20 '17 at 21:53
  • $\begingroup$ OK thanks, but it doesn't look like there was a simple solution to that one $\endgroup$ – M.R. Dec 20 '17 at 22:39
  • $\begingroup$ You could use the function NormalizeGraphics from my answer to that question instead of Normal, although it still returns a Parallelogram object instead of a Rectangle object. $\endgroup$ – Carl Woll Dec 20 '17 at 22:52