Subject: CGAL users discussion list
List archive
- From: Frédérik Paradis <>
- To:
- Subject: Re: [cgal-discuss] Get corners of a Kd_tree_rectangle as Point_d
- Date: Wed, 20 Apr 2016 08:09:54 -0400
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-phdr: 9a23:wyoJbxe11XSVcHXZqBrMHysClGMj4u6mDksu8pMizoh2WeGdxci6Zh7h7PlgxGXEQZ/co6odzbGG4+a+Bydcvd6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDivcONKFkUzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IAu3Heb8lR+lYECg+KDJyo9b6sAHKCwqJ/HoVFGsM1QFZBhDMqxD8UJC2uSTzsq9x2TKRINbtHo0yQimouqd3VAfz2mBALC886GiRi8pqjasdrgjmvA1624eTYYebM711carZON8bXmFcRd0CaipaH4npb5cTF/FTeqFDvozlrh0PqwG/DE+iHqT02zpQjzj326M9lO8uGAWD0A07FM8Vqyfoq4D+O64WFOy016LV1i7rbvVM2D675pKbXAompKSiRzN88NDQygEXHhnMglSL4djrJzqP37xQ40CG6PZ8XP2mzWUu/VIi6gOzz9sh39GazrkezUrJoH10
On 04/19/2016 03:27 PM, Frédérik Paradis wrote:
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 ;)
I updated it with comments and refactoring.
The advantage of this method is that you don't need to loop over
all the points of the rectangle.
So what you're suggesting is that I do similarly as in the gist I sent
you but instead of walking along the list of points, I just take the
coordinates of type FT returned by the Kd_rectangle class? I cannot use
the CommonFactor concept as it results in compilation error when using
Quotient<double>.
If you have a minimal example showing the compilation issue I can have a look.
https://gist.github.com/freud14/7a8d87c3b9d00e91ea6c5b22487c6300 Replace CGAL::Homogeneous_d<int> by CGAL::Homogeneous_d<double>.
Frédérik
2016-04-20 3:26 GMT-04:00 Sebastien Loriot (GeometryFactory) <>:
On 04/19/2016 03:27 PM, Frédérik Paradis wrote:
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 ;)
I updated it with comments and refactoring.
The advantage of this method is that you don't need to loop over
all the points of the rectangle.
So what you're suggesting is that I do similarly as in the gist I sent
you but instead of walking along the list of points, I just take the
coordinates of type FT returned by the Kd_rectangle class? I cannot use
the CommonFactor concept as it results in compilation error when using
Quotient<double>.
If you have a minimal example showing the compilation issue I can have a look.
Sebastien.
Thank you.
Frédérik
2016-04-19 2:46 GMT-04:00 Sebastien Loriot (GeometryFactory)
< <mailto:>>:<mailto: <mailto:>>>:
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
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
--
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.