Boost logo

Geometry :

Subject: [ggl] ggl::equals
From: Barend Gehrels (Barend.Gehrels)
Date: 2009-07-11 07:56:59


Hi Chris,

>
> In the context of ggl::index, is this ggl:equals code right?
>
> template <typename B1, typename B2, std::size_t D, std::size_t N>
> struct box_box
> {
> static inline bool apply(B1 const& box1, B2 const& box2)
> {
> if (!math::equals(get<max_corner, D>(box1),
> get<min_corner, D>(box2))
> || !math::equals(get<min_corner, D>(box1),
> get<max_corner, D>(box2)))
> {
> return false;
> }
> return box_box<B1, B2, D + 1, N>::apply(box1, box2);
> }
> };
>

What happened here... I was sleeping. It is totally wrong indeed. It
should be:

        if (!math::equals(get<min_corner, D>(box1), get<min_corner,
D>(box2))
            || !math::equals(get<max_corner, D>(box1), get<max_corner,
D>(box2)))

Sorry for the error. We didn't have a testcase for it until now.

>
> If I understand well, 2 geometries are not considered equal if
> *max*(box1) <> *min*(box2) || *min*(box1) <> *max*(box2) ????

GGL assumes "correct" boxes, where min <= max. So no, the above is not
considered equal (one is an 'inside-out' box).
(There CAN be a situation where min >= max, being still correct, that is
in a spherical box (e.g. 170..-165) )

>
> I'm asking because of this code in ggl::index::rtree
>
> if (leaf->elements() < m_min_elems_per_node &&
> elements() > m_min_elems_per_node)
> {
> q_leaves = leaf->get_leaves();
>
> // we remove the leaf_node in the parent node
> because now it's empty
>
> leaf->get_parent()->remove(leaf->get_parent()->get_box(leaf));
> }
>
>
> where the leaf is not actually removed...
>
Is probably fixed now by fixing the ggl::equals, just checked it in.

Thanks, Barend

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20090711/ce92bf34/attachment.html


Geometry list run by mateusz at loskot.net