Problem with AABB.AABB_tree_Segment_3_soup() intersections and primitive Ids

56 views
Skip to first unread message

Tim Pierson

unread,
Sep 19, 2013, 10:01:36 PM9/19/13
to cgal-bindi...@googlegroups.com

   I was under the impression that the primitive ID returned by the various Segment_3 queries in the AABB package represented the index of the primitive in the original list given to the soup constructor. This doesn't seem to be the case.

Here's a snip of code:

   s=# a list of 4 segments

   sa= #a segment that intersects only one of the four segments in s

    itr=[]

    tree=AABB_tree_Segment_3_soup(s)

    tree.accelerate_distance_queries()

    tree.all_intersections(sa,itr)

    if len(itr)==0:

        return False

    elif len(itr)==1:

        print itr[0].second, len(s), s

the output from the print is:

7 4 [<CGAL.CGAL_Kernel.Segment_3; proxy of <Swig Object of type 'Segment_3 *' at 0x110252840> >, <CGAL.CGAL_Kernel.Segment_3; proxy of <Swig Object of type 'Segment_3 *' at 0x1102527b0> >, <CGAL.CGAL_Kernel.Segment_3; proxy of <Swig Object of type 'Segment_3 *' at 0x1102528a0> >, <CGAL.CGAL_Kernel.Segment_3; proxy of <Swig Object of type 'Segment_3 *' at 0x110252810> >]

the id is 7?  what could that refer to?  what's stranger is that if I add another segment to s, the id becomes 12.  am I misunderstanding something?

Thanks for any clarification

Tim Pierson

unread,
Sep 20, 2013, 11:21:05 AM9/20/13
to cgal-bindi...@googlegroups.com
I've just looked into the cpp AABB source and it looks like the primitive ID for Segment_3 queries gets multiplied by query.get_data() stored as "res," what does this do?

  //any_intersected_primitive
  Optional_primitive_id any_intersected_primitive(const Segment_3 & query) {
    boost::optional<typename Tree::Primitive::Id> res=data.any_intersected_primitive(query.get_data());
    if (res)
      return Optional_primitive_id(Primitive_id(*res));
    return Optional_primitive_id();
  } 

Tim Pierson

unread,
Sep 22, 2013, 3:47:58 PM9/22/13
to cgal-bindi...@googlegroups.com
Figured it out.  It was bad increment behavior in the primitive counter.  Another issue on this list clarified that one needs to run tree.reset_id() in between every tree building operation.


On Thursday, September 19, 2013 10:01:36 PM UTC-4, Tim Pierson wrote:
Reply all
Reply to author
Forward
0 new messages