Re: [Spatial] Declaring a metric problem
Library of generic, k-d tree multi-dimensional containers
Brought to you by:
bouhdevel
|
From: Sylvain B. <syl...@gm...> - 2017-02-12 12:46:19
|
Hi Taylor,
It looks like the piece of code you sent is incomplete, could you send me
the source itself (or simply the files involved so that I have a look at
it)? In particular, in the last line, I need to know how you instantiate
"metric".
Btw, looking at the definition of your metric, I saw:
double distance_to_plane(dimension_type rank, dimension_type dim,
const coord& origin, const coord& key) {
return 0.0;
}
distance_to_plane() should not return 0.0 or you will not find the true
nearest neighbor. It should return the computed distance to the hyperplane
perpendicular to the axis represented by dim and the point origin, and the
point key.
In case of a manifold, like the one defined by the coordinate system Lat,
Long for example, if I have 2 sets of coordinates:
(lat = 0, long = 60) and (lat = 0, long = 61), if I search
distance_to_plane() along the second axis (long), then it should return 1
because I am looking at longitudes at the equator.
for (lat = 90, long = 60) and (lat = 90, long = 61), if I search
distance_to_plane() along the second axis (long), then it should return 0
this time. The reason is that since you are at the north pole (lat=90), all
longitudes are meeting at the same location.
Best regards,
Sylvain
On Sat, Feb 11, 2017 at 3:05 PM Taylor, Wesley <tay...@se...>
wrote:
> Hello,
>
>
>
> We are trying to find the 5 closest spots from a given longitude and
> latitude. And we are getting a undefined reference.
>
> This is our struct that we defined for our metric
>
>
>
> typedef spatial::point_multiset<2, coord,
>
> spatial::accessor_less<coord_acc, coord>>
> tree;
>
>
>
> typedef double distance_type; //[1]
>
> double
>
> distance_to_key(dimension_type rank,
>
> const coord& origin, const coord& key)
> const; //[2], [4]
>
>
>
> double
>
> distance_to_plane(dimension_type rank,
> dimension_type dim,
>
> const coord& origin, const coord& key)
> const; //[3],[4]
>
>
>
> double distance_to_plane(dimension_type
> rank, dimension_type dim,
>
> const coord& origin, const coord& key) {
>
> return 0.0;
>
> }
>
>
>
> double distance_to_key(dimension_type rank,
>
> const coord& origin, const coord& key) {
>
> distance_type distance;
>
> distance =
> getDistance(origin.lat, origin.lon, key.lat, key.lon, 'M');
>
> return distance;
>
>
>
> }
>
> };
>
>
>
> This is how we call the neighbor iterator
>
> neighbor_iterator<tree, guacMet> iter = neighbor_begin(container, metric,
> target);
>
>
>
> I do not know hwy we are getting a undefined reference to
> guacMet.distance_to_plane and guacMet_distance_to_key
>
>
>
> Any help would be greatly appreciated.
>
>
>
> Thank you
>
> Wes
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Spatial-main mailing list
> Spa...@li...
> https://lists.sourceforge.net/lists/listinfo/spatial-main
>
|