Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d
- Date: Tue, 19 Apr 2016 08:46:51 +0200
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:qds7wxA6YK7nEkuB1XC6UyQJP3N1i/DPJgcQr6AfoPdwSP/6rsbcNUDSrc9gkEXOFd2CrakU26yI6Ou5ADBIyK3CmU5BWaQEbwUCh8QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYsExnyfTB4Ov7yUtaLyZ/nh6bsoNaKOlkArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIYTGZj8ZLkyGLxEECw9YSdy/9zurRCFTA2V53JaXH9RiQtNGwGC7Rf0WdD6vSL+8+Z8wyKHJtalcbdhUjur6+JnSQTjlTwcHz8/6mDezMJq34xBpxf07SdyyYfPfICYMrJaebnces9SBUVMWcNcSzZQLIq3c4wVHqtLdbJDq47nplwS6x66LQapDeLrjDRPgymljuUBz+09HFSej0QbFNUUvSGMoQ==
- Organization: GeometryFactory
On 04/18/2016 02:53 PM, Frédérik Paradis wrote:
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?
Never use min and max as variables some versions of MSVC will not compile.
You could have checked that .homogeneous(d) are different for all
the coordinates before doing the product.
BTW, github storage is not so restricted so you can add some comments
in your code ;)
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.
The advantage of this method is that you don't need to loop over
all the points of the rectangle.
IIRC the denominator will be 1 in that case.
Sebastien.
Thank you.
Frédérik
2016-04-18 3:50 GMT-04:00 Sebastien Loriot (GeometryFactory)
<
<mailto:>>:
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
- [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Frédérik Paradis, 04/16/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Sebastien Loriot (GeometryFactory), 04/18/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Frédérik Paradis, 04/18/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Sebastien Loriot (GeometryFactory), 04/19/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Frédérik Paradis, 04/19/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Sebastien Loriot (GeometryFactory), 04/20/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Frédérik Paradis, 04/20/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Marc Glisse, 04/20/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Frédérik Paradis, 04/20/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Frédérik Paradis, 04/25/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Sebastien Loriot (GeometryFactory), 04/26/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Frédérik Paradis, 04/20/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Sebastien Loriot (GeometryFactory), 04/20/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Frédérik Paradis, 04/19/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Sebastien Loriot (GeometryFactory), 04/19/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Frédérik Paradis, 04/18/2016
- Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d, Sebastien Loriot (GeometryFactory), 04/18/2016
Archive powered by MHonArc 2.6.18.