Google Answers Logo
View Question
Q: Maximizing the size of multiple graphics in a given space ( No Answer,   0 Comments )
Subject: Maximizing the size of multiple graphics in a given space
Category: Computers > Programming
Asked by: canadia-ga
List Price: $20.00
Posted: 02 Nov 2006 17:37 PST
Expires: 02 Dec 2006 17:37 PST
Question ID: 779610
Despite the way this question sounds, this is not a homework or exam
question. I'm working on some research on the side on maximizing the
use of certain UI areas and thought it would be easier to offload this

Assume you have X and Y, which represent a rectangular space starting
from 0,0. This represents a rectanglular piece of "real estate" you
see on the screen.

You are now given a list of values, each representing a percentage of
"ownership" of that rectangular space (eg. 50%, 7%, 13% ...always
whole percentages).  Each value is tied to an image/graphic that we
want to put into this rectangular space.  The graphic is always
*square* in shape.

You can assume that each graphic can be scaled larger or smaller as
much as needed. There is another input that designates the smallest
possible graphic we allow, therefore avoiding the problem of
infinitessimally smaller squares. Example is 1%, which means that no
graphic will ever be smaller than 1% of the rectangular space.

I am okay with replicating the square graphic as many times as needed
in the given space, but want to minimize this as much as possible.
That is, I want to use a graphic as few times as possible, by scaling
the original square graphic larger to fill a square space and
repeating this until the overall space used equals its corresponding
percentage that was specified originally.

The output should be an array for each graphic. In each array will be
a list of the x,y coordinates of the top left and bottom right of
every specific graphic to maximally fill it's percentage of real
estate. (Using the least number of graphics possible, per graphic)

An example.  Suppose the overall rectangular space is square.  (0,0)
and (100,100). We have three owners

Alpha owns 50% space
Beta owns 25%
Charlie owns 25%

Alpha would be
(0,0), (50,50)
(0,50), (50, 100)

Beta would be
(50,0), (100, 50)

Charlie would be 
(50,50), (100, 100)

This is an overly simple example, there will be cases where the area
for each owner will not be square, so you need to split it into
smaller and smaller squares to cover the screen real estate.

For an answer, we would like it preferably in PHP but will accept
VBscript or javascript.
There is no answer at this time.

There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy