Visit_within_range predicate

Paul Harris paulharris at computer.org
Sun Aug 23 02:55:59 UTC 2009


the find_ and visit_ methods either will find the 'nearest', or find 'all'
in the range...
So without writing a new method called something like
visit_first_within_range(), you could just throw an exception inside the
visitor when you have a satisfactory result.

eg

struct found_one
{
   YourInfo info;
};

class Visitor
{
   etc operator() etc
  {
    found_one result;  result.info = whatever;  throw result;
  }
}

then a try, catch block will catch the results.

Sorry thats a bit messy, but thats one approach.

Paul


2009/8/23 Andrew Leung <anwleung at gmail.com>

> Hi,
>
> I am using libkdtree++ and would like to get a couple of tips on how I can
> improve my performance.
>
> In most instances when I query the KD-tree using the visit_within_range()
> function, I do not need to continue the search once any tree node is found
> that is within the range. Is there a way to stop the query once a node is
> found to satisfy the query? The REGION.encloses() call tends to be very
> expensive and I would like to avoid any needless calls to this function. Is
> it possible to just 'return visitor;' when the REGION.encloses() condition
> is meet?
>
> Thanks.
> Andrew
>
> _______________________________________________
> libkdtree-devel mailing list
> libkdtree-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/libkdtree-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libkdtree-devel/attachments/20090823/9ecf3733/attachment.htm>


More information about the libkdtree-devel mailing list