Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Re: quickest algorithm for calculating buffer area

New Message Reply Date view Thread view Subject view Author view

Subject: Re: quickest algorithm for calculating buffer area
From: Jean-Pierre Muller (jean-pierre.muller@cirad.fr)
Date: Thu Mar 04 2010 - 16:22:39 CET

Look at:

http://publish.uwo.ca/~jmalczew/gida_1/Zhan/Zhan.htm

one of this algorithm (and some variant...any place at distance X with
characteristics Y, etc.) has been implemented in Mimosa on abstract
spaces (the space just provides a place given its name (which could be
its coordinates) and the neighbors of any place with a metrics...easy
to instantiate for a grid) and it proved very efficient.

Good luck

JP

Le 4 mars 10 à 16:09, Becu Nicolas a écrit :

> Hello everyone,
>
> On a model I have an extensive use of buffer areas (the cells that
> are at a maximum distance X of another cell).
> I need to use this so much that I'm trying to reduce as much as
> possible the calculation time required for this method.
>
> I manage to gain time since the first method I used but it's still
> quiet long and I would like to ask you if you have quicker solution
> than the one I'm using.
>
> //some details on the model// the grid I'm using is 129*129 and the
> buffers are 23 cells around the central cell.Most of the cells have
> to calculate their buffer once or more during a simulation
>
> At first I had try using ""allLayersTo: radius "" or
> ""recursiveNeighbourhood"" but I found out the calculation was
> quicker when I use the x and y coordinates of the cells (in top of
> that using the x and y cordinates to calculate the circle around a
> cell, allows me to have a circular buffer instead of quadrilateral
> buffer when using neighborhood calculation // I have squared shape
> cells)
>
> This is the algorithm I'm currently using.
> Any idea how this algorithm could be improve ?
>
> bufferCellsAt: dist
> |aa bb cc cells|
> "I use at the Cell level a dictionary that stores the results of the
> buffers that have already been calculated so that if I need to get
> the same buffer a second time, it is not calculated it again and the
> result is just fecth in the dictionary"
> (self dicoBufferCells includesKey: dist) ifFalse:
> ["this is the algorithm for identifying the cells that
> compose the buffer area"
> cc := dist * dist.
> cells := Set new.
> self spaceModel cormasModel theCells do:[:c|
> c ~= self ifTrue:[
> aa := (c x - self x).
> bb := (self y - c y).
> ((aa * aa ) + (bb * bb )) < cc ifTrue:[cells
> add:c]]].
> self dicoBufferCells at: dist put:cells ].
> ^self dicoBufferCells at: dist
>
>
> Thanks,
> Nicolas
>
>

------------------------------------
Jean-Pierre Muller e-
mail: jean-pierre.muller@cirad.fr
Senior scientist
tel.: +33 (0)4 67 59 38 28
CIRAD TA C-47/F
secr.: +33 (0)4 67 59 39 58
Campus International de Baillarguet fax: +33 (0)4
67 59 38 27
34398 Montpellier cedex 5 - France web: http://cormas.cirad.fr
Associate researcher to:
LIRMM
                                                                    e-
mail: jean-pierre.muller@lirmm.fr
161, rue Ada
tel.: +33 (0)4 67 41 86 07
34392 Montpellier cedex 5 - France web: http://www.lirmm.fr/~muller

New Message Reply Date view Thread view Subject view Author view
 

Back to home