Puzzling with ads on magazine pages

David Vaughan drvaughan55 at mac.com
Thu Apr 11 01:41:00 EDT 2002


On Thursday, April 11, 2002, at 02:41 , Terry Vogelaar wrote:

> I need to make a program that figures out how a couple of rectangles fit
> best into a number of larger rects. OK, this sounds too cunfusing. I 
> need to
> make a program that fits several advertisements on 12 magazine pages. 
> And I
> want Revolution to figure out what ad should be placed where. None of 
> the
> ads has a standard width or height. The ads don't need to align, 
> however. As
> long as they fit and as long as they don't overlap.
>
> Challenging, isn't it?
>
> Any suggestions to get started?

Terry,

Yes. You could start with a bin-packing algorithm but that would choose 
the minimum number of pages and give you a jammed layout on some with 
little or nothing on others. I do not know how tight the constraints but 
how about starting by sorting the rectangles (the ads) by size then 
distributing from largest down across the pages, one per page, then 
continue iterating across the pages in descending size as long as they 
fit. At the end, randomise your pages so that as you turn them you are 
not obviously descending by largest ad size.

Alternatively, start with the size-sorted ads and in groups of twelve 
randomly distribute them one to each page.

One of these ought to give a reasonable size balance between any two 
pages. You can always fiddle at the end for aesthetics once you have a 
draft layout.

Will that get you started?

cheers
David

>
> Terry
> http://www.discovery.nl
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list