Conversation
lrineau
left a comment
There was a problem hiding this comment.
I know this is a work-in-progress. I have a few suggestions anyway.
| operator()(const typename K::Ray_3& ray, | ||
| const typename K::Point_3& query, | ||
| const K& k) |
There was a problem hiding this comment.
Please do not change the indentation. It was correct.
| operator()(const typename K::Ray_3& ray, | |
| const typename K::Point_3& query, | |
| const K& k) | |
| operator()(const typename K::Ray_3& ray, | |
| const typename K::Point_3& query, | |
| const K& k) |
| typename K::Point_3 | ||
| operator()(const typename K::Sphere_3& sphere, | ||
| const typename K::Point_3& query, | ||
| const K& k) | ||
| { |
There was a problem hiding this comment.
| typename K::Point_3 | |
| operator()(const typename K::Sphere_3& sphere, | |
| const typename K::Point_3& query, | |
| const K& k) | |
| { | |
| typename K::Point_3 | |
| operator()(const typename K::Sphere_3& sphere, | |
| const typename K::Point_3& query, | |
| const K& k) | |
| { |
| typename K::Construct_point_3 point = k.construct_point_3_object(); | ||
| typename K::Compute_x_3 x = k.compute_x_3_object(); | ||
| typename K::Compute_y_3 y = k.compute_y_3_object(); | ||
| typename K::Compute_z_3 z = k.compute_z_3_object(); | ||
| typename K::Construct_vector_3 vector = k.construct_vector_3_object(); | ||
| typename K::Construct_center_3 center = k.construct_center_3_object(); | ||
| typename K::Compute_squared_radius_3 squared_radius = k.compute_squared_radius_3_object(); | ||
| typename K::Compute_squared_length_3 squared_length = k.compute_squared_length_3_object(); |
There was a problem hiding this comment.
Just a note: you can use auto instead of typing all those types.
| if (sq_len < sq_rad) | ||
| return query; |
There was a problem hiding this comment.
So, if the query is inside the sphere, it stays where it is? Does this mean the project of query to the sphere is actually a projection to the ball?
| if (sq_len == 0) { | ||
| return point(x(c), y(c), z(c) + rad); | ||
| } |
There was a problem hiding this comment.
Before there was already
if (sq_rad == 0) return c;if (sq_len < sq_rad) return query;
so I think sq_len == 0 is not possible. Can we assume that squared_radius(sphere)>=0?
| const typename K::FT len = CGAL::sqrt(sq_len); | ||
| const typename K::FT f = rad / len; |
There was a problem hiding this comment.
In generate I do no really like short names, especially when the longer names are already short:
| const typename K::FT len = CGAL::sqrt(sq_len); | |
| const typename K::FT f = rad / len; | |
| const typename K::FT length = CGAL::sqrt(sq_len); | |
| const typename K::FT fraction = radius / length; |
| const typename K::FT len = CGAL::sqrt(sq_len); | ||
| const typename K::FT f = rad / len; | ||
|
|
||
| return point(x(c) + f * x(v), y(c) + f * y(v), z(c) + f * z(v)); |
There was a problem hiding this comment.
You should not use the x/y/z coordinates. Use higher-level constructions from the kernel:
| return point(x(c) + f * x(v), y(c) + f * y(v), z(c) + f * z(v)); | |
| auto scaled_vector = k.construct_scaled_vector_3_object(); | |
| auto translated_vector = l.construct_translated_vector_3_object(); | |
| return translated_vector(center, scaled_vector(v, factor)); |
| @@ -0,0 +1,99 @@ | |||
| // Copyright (c) 2012 INRIA Sophia-Antipolis (France). | |||
Summary of Changes
Adding a primitive type allowing to create an AABBtree of Sphere_3.
Release Management