2015 Archives by date, by thread · List index

# Re: [libreoffice-users] Re: Filter algorithm question

```At 19:15 22/02/2015 -0700, Nobody Noname wrote:
```
If I had a known irregular shape I could map it onto the existing grid. A brute force approach would be to just make a list of all the X-Y coordinates in the irregular area, then just search through the entire grid and see if any coordinates show up in the list, and count them if they do.
```
```
I think you are making work for yourself by suggesting doing this backwards. Don't create a list of cells in the shape and look to see if each contains a bird. Instead, use the defined boundary of the shape to determine directly whether each potential bird is in the shape. You need only one list - of birds. You don't need a list of cells that appear in the shape, just some way of determining whether any bird is inside it. Once you have the edges of the shape defined in some way, constructing a COUNTIF() condition to apply to the list of birds will give you what you need. Kidneys don't usually have holes (mine don't; I trust yours don't), so you probably need only a list of (two) limiting Y co-ordinates for each X value - or vice versa if this is easier.
```
```
Creating this kind of pre-defined list with a grid that had a lot of coordinates would be tougher as it would need to be done programmatically.
```
```
But you don't need this list: all you need is those co-ordinates (of the shape) in order to determine whether any bird in inside. How you get this depends on how your shape is defined (which you have not explained).
```
At 20:04 22/02/2015 -0700, Nobody Noname wrote:
```
```the algorithm I'm looking for is called "Flood Fill" ...
```
```
```
I really don't think it is - if your problem is as originally explained. If you want to colour in your imaginary diagram, by all mean use this. But once you have the definition of the shape (as you would need if you wanted to use flood fill), you can easily determine the status of each bird directly.
```
```
Brian Barker
```
--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
```