[OT] Poll: What does it mean for 1 rect to be 'within' a certain distance of another rect?
Paul Dupuis
paul at researchware.com
Tue Feb 16 16:43:02 EST 2021
On 2/16/2021 2:46 PM, Alex Tweedly via use-livecode wrote:
> Paul - if you need to do this (i.e. find pairs of rects which are too
> close) for LARGE numbers of rects, I have some code to do this very
> efficiently (somewhere in an old archive, just ready to translate from
> C to LC). It uses a 'trailing window horizontal scan' so reduces the
> complexity/time from N^2 to N log N
>
> Alex.
>
The actual application is for a product my company Researchware produces
called HyperRESEARCH for performing qualitative data analysis.
Researchers can take unstructured content (text files, word documents,
PDFs, images, audio, video, etc.) and make selection and apply a "code"
or label to the selection and perform various analytics.
In this specific case there is an interest in generating the following
"report". If I have coded some rectangular area of an image file with
the code "A", report on what other of my many codes on that image file
are "within" X pixels of my code A and list those codes. So the
researcher would select code "A" and a range, like 50px, and get a list
of codes B, E, F, and G which either overlap with A or are within 50px.
If they change the distance to 200px, then maybe the report returns
codes B, E, F, G, H, I J, K, L, M, N, and Z.
The report generator is not working with graphic objects (actual LC
rects, but just with lists of stored rectangles (l,t,r,b), so everything
is in variables and it is just tacking the rect of A and comparing it to
the remaining N-1 rects in the list of codes for that image file. So it
will always be an N-1 task for each file where N is the number of codes
the researcher applied to the content of the file. Worst case would be
if they want to see what codes are within X distance of every code on
the file which makes it an N(N-1) or N^2-N problem but most researchers
would not have very large numbers of iimage codes.
More information about the use-livecode
mailing list