How to get the dimensions of a rectangle?

Suppose I create a Rectangle of dimensions 1 and 3. Is there any function in Mathematica that I can use to recover the dimensions of the original rectangle? If there is no such a function, is there a way of recovering the dimensions?



1 Answer


I assume you mean from a Graphics object. If so, something like:

Cases[g, Rectangle[x___] :> {x}, 2]

where g is the graphics object will return a list of coordinates from which dimensions can be derived.



It works perfectly, thank you very much
– libercaptor
Mar 19 ’14 at 1:21



Worth to add Normal on g in case of GraphicsComplex.
– Kuba
Mar 19 ’14 at 6:00