[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] how to identify empty space on a qcanvas
From:       Mike Tammerman <mtammerman () gmail ! com>
Date:       2005-05-27 8:08:13
Message-ID: e3bbdd4405052701086b5bfd64 () mail ! gmail ! com
[Download RAW message or body]

1. Retrieve all items from the canvas with QCanvas.allItems() method,
then make a set with the points of the item. Call it A.

2. Make a full set with all the points in the canvas. Call it B.

3. Get the difference. (B - A)

If your items are as simple as rectangels, it would be trivial.

Mike

On 5/27/05, Solly Brown <sollyb@cse.unsw.edu.au> wrote:
> I've got a qcanvas with a number of canvasitems moving about on it. I need
> to efficiently identify which areas of the canvas are empty (ie. don't
> have any objects on them).
> 
> The simplest implementation is to lay down a grid of qpoints on the
> canvas, and then just check whether there are collisions with each point
> -- if there are no collisions then that particular point area is empty.
> 
> The problem with this is that it's really slow... a 40x40 grid has 1600
> points and looping through all of them and calling 'collisions' on each
> one makes my display slow to a crawl.
> 
> Can anyone suggest an efficient way of identifying which points on a grid
> are clear (don't have collisions above them)?
> 
> Thanks for your help....!
> 
> Solly
> 
> _______________________________________________
> PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic