Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d


Chronological Thread 
  • From: Frédérik Paradis <>
  • To:
  • Subject: Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d
  • Date: Mon, 18 Apr 2016 08:53:24 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:6asvDxMMAIDmjtX0+Wwl6mtUPXoX/o7sNwtQ0KIMzox0KPX9rarrMEGX3/hxlliBBdydsKIUzbSM+P2+EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35Txibr5psObSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Lpyv/NGSrjwKqQkUaRDXnNhKHEw/MSttB/ZTALJ6GFbSXQTihMPAg7L61bxUZ719yf7reFgwzLJAcqjRr89XXGu7rxgVQTzoCYBLT8wtm/N2eJqi6cOjgggq51lwo2cWIiPPfZ/ZeuJc8sTX2MZA5Z5SitdHoqjZs0EBrxSbq5js4Dhqg5W/lOFDg62Cba3xw==

Hi,

Thank you for your answer. So, before your answer, I reimplemented the features I needed from Point_container. The instantiation of the Iso_box_d looks like that: https://gist.github.com/freud14/88f014742122dc82b9a5a1b87feda5cc Do you see anything wrong with that approach?

Also, I looked at the FractionTraits and it seems that the number type must be of model ExplicitInteroperable which is not always the case when, for instance, the kernel is CGAL::Homogeneous_d<double>. Please correct me if I am wrong.

Thank you.

Frédérik


2016-04-18 3:50 GMT-04:00 Sebastien Loriot (GeometryFactory) <>:
Looking at how things are implemented, in the Homogeneous case I think
you have no other choice than decomposing each Cartesian coordinate
to find a common RT factor.
If I have to do it, I would use a functor/function specialized in the
Homogeneous case.

For the specialization you can use the nested Kernel_tag for the Kernel
you are using that is either CGAL::Homogeneous_tag or
CGAL::Cartesian_tag.

For the decomposition, you can use Fraction_traits [1] that provides
a Decompose functor [2].

HTH

Sebastien.

[1] http://doc.cgal.org/latest/Algebraic_foundations/classCGAL_1_1Fraction__traits.html

[2] http://doc.cgal.org/latest/Algebraic_foundations/classFractionTraits___1_1Decompose.html


On 04/16/2016 12:28 AM, Frédérik Paradis wrote:
HI,

I am using the class Point_containter to generate and split the bounding
box of a point set. I would like to get the bounding box as an
Iso_box_d. However, the Point_container class only offers a method
bounding_box which return a Kd_tree_rectangle. The only way to retrieve
the coordinates of the corners of the rectangle seems to be the methods
min_coord and max_coord which both returns the cartesian coordinate for
the dimension i with the type FT.

The problem arises when I'm using the Homogeneous_d kernel with whatever
ring type because the ring type and the field type are not the same and
thus trigger a compilation error.

Here is my current code:

       std::vector<FT> min;
       std::vector<FT> max;
       const Kd_tree_rectangle<FT, D>& kdbox = container.bounding_box();
       for(int i = 0; i < d; i++) {
         min.push_back(kdbox.min_coord(i));
         max.push_back(kdbox.max_coord(i));
       }
       bbox = Iso_box_d(Point_d(d, min.begin(), min.end()),
                         Point_d(d, max.begin(), max.end()));

Is there any way to make it work with Point_container or will I have to
compute the corners by iterating over all points?

Thank you.

Frédérik



--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss






Archive powered by MHonArc 2.6.18.

Top of Page