Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Aspect Ratio

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94996] Re: [mg94985] Aspect Ratio
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Thu, 1 Jan 2009 21:51:59 -0500 (EST)
  • References: <200901020129.UAA23788@smc.vnet.net>
  • Reply-to: drmajorbob at longhorns.com

Here are two methods. The first depends on knowing precisely the structure  
of the Graphics object (not likely in practice).

r1 = Graphics[Rectangle[{0, 0}, {1, 10}]];
r2 = Graphics[Rectangle[{0, 0}, {1, 2}]];

r1[[1, -1]]
r2[[1, -1]]

{1, 10}

{1, 2}

The second method doesn't have THAT flaw, but it could return coordinates  
 from embedded rectangles OTHER than the one you want. (Depending on how  
you derived the object in the first place.)

Cases[{r1, r2}, r_Rectangle :> Last@r, Infinity]

{{1, 10}, {1, 2}}

Bobby

On Thu, 01 Jan 2009 19:29:08 -0600, Nathan Myhrvold <nathanm at intven.com>  
wrote:

> Here is a simple question - is there a way to find out the aspect
> ratio of a graphics object?
>
> So if I have
>
> r1 = Graphics[Rectangle[{0,0},{1,10}]]
> r2 = Graphics[Rectangle[{0,0},{1,2}]]
>
> I want to recover {1,10} from r1, and {1,2} from r2.
>
>
> Nathan
>
> This message and any attachments, may contain confidential and/or  
> legally privileged information.  If you are not the intended recipient  
> of the message by the original sender, please destroy it.   Message and  
> attachments copyright =A9 2008, all rights reserved.  Any unauthorized  
> dissemination, distribution or copying is strictly forbidden
>



-- 
DrMajorBob at longhorns.com


  • References:
  • Prev by Date: Re: Re: Test for composite digit
  • Next by Date: Re: Aspect Ratio
  • Previous by thread: Aspect Ratio
  • Next by thread: Re: Aspect Ratio