At 10:18 22/02/2015 -0700, Nobody Noname wrote:
Imagine you had a square plot of land. You could assign this to a
grid and create a two dimensional graph with an X and Y-axis. Now
imagine an inner square plot that's a wildlife sanctuary. Now you
fly a camera drone over the outer plot and photograph all the
pelicans nesting there. So your covering the outer plot and the
inner sanctuary plot. Now you digitize the photo, enabling you to
turn the pelicans into points on the X & Y graph. Then you take
these X & Y points and either put them in a serial file or a
spreadsheet. Now you want to filter the data, going through the X, Y
pairs, and finding only those within the boundaries of the inner
sanctuary plot. [...]
This is great if the inner plot is rectangular. My question is, what
if its irregular like a kidney shaped swimming pool? What would the
filter code look like?
This would depend critically on how your kidney shape was defined -
and would be unanswerable without knowing this. There are various
possibilities.
o Do you, for example, have a mathematical description of the kidney
shape? If you know this and if you know sufficient locating points -
perhaps the extreme edges or the centre and length or whatever - then
you should be able to construct a mathematical expression that
defines its edges in terms of your X and Y co-ordinates above. In
that case, it would be a simple matter to determine if each relevant
data point lay inside your shape.
o Alternatively, you may have the shape defined by a drawing - as
accurate as necessary. This would almost certainly be what you have
if the "kidney shape" is not some known mathematical shape. In that
case, you probably need first to superimpose your shape on your X-Y
axes and determine empirically how it fits. You would effectively be
constructing a regular grid on your X-Y plane and determining which
cells of that grid were inside the shape. You could list either all
the individual cells or perhaps the Y limits of the shape for each X
co-ordinate or vice versa. By choosing a sufficiently finely divided
grid, you could achieve what you needed with arbitrary accuracy.
Once you have the limits of the shape codified in some way, it should
be easy to construct a COUNTIF() expression to count the items
satisfying the criterion.
I trust this helps.
Brian Barker
--
To unsubscribe e-mail to: [email protected]
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