MathGroup Archive 2009

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

Search the Archive

Re: Aspect Ratio

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94997] Re: [mg94985] Aspect Ratio
  • From: "Nathan Myhrvold" <nathanm at intven.com>
  • Date: Thu, 1 Jan 2009 22:34:07 -0500 (EST)
  • References: <200901020129.UAA23788@smc.vnet.net> <op.um3xtmkrtgfoz2@bobbys-imac.local>

Thanks!  I was hoping that this would work for arbitrary graphics - 
including Text[] in various fonts.  I will try it.

My goal here is that I want to use Inset[] to compose various 2D and 3D 
graphics together.

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


-----Original Message-----
From: DrMajorBob [mailto:btreat1 at austin.rr.com]
Sent: Thursday, January 01, 2009 6:14 PM
To: Nathan Myhrvold; mathgroup at smc.vnet.net
Subject: [mg94997] Re: [mg94985] Aspect Ratio

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: Aspect Ratio
  • Next by Date: Re: Re: Aspect Ratio
  • Previous by thread: Re: Aspect Ratio
  • Next by thread: Re: Re: Aspect Ratio