Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel: Collinear_3: Static Analysis #5242

Merged
merged 3 commits into from
Jan 22, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 10 additions & 60 deletions Filtered_kernel/include/CGAL/internal/Static_filters/Collinear_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,33 +76,14 @@ class Collinear_3
else if (max1 > upper_bound_1)
upper_bound_1 = max1;

int int_tmp_result;
if (lower_bound_1 < 5.00368081960964635413e-147)
return Base::operator()(p, q, r);
else
{
if (upper_bound_1 > 1.67597599124282407923e+153)
return Base::operator()(p, q, r);

if ((lower_bound_1 >= 5.00368081960964635413e-147) && (upper_bound_1 <= 1.67597599124282407923e+153)) {
double eps = (8.88720573725927976811e-16 * (max1 * max2));
if (double_tmp_result > eps)
int_tmp_result = 1;
else
{
if (double_tmp_result < -eps)
int_tmp_result = -1;
else
return Base::operator()(p, q, r);
}
if ((double_tmp_result > eps) || (double_tmp_result < -eps))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you changed the next one to use abs()>eps but not this one? (not CGAL::abs so it would use sse2fabs on windows?)
we could move the computation of double_tmp_result just before this line, though it probably doesn't change anything, so not necessary.

return false;
}

int sign_of_determinant_return_value = int_tmp_result;
if (sign_of_determinant_return_value != 0)
return false;

double dpz = (pz - rz);
double dqz = (qz - rz);
int int_tmp_result_3SPBwDj;

double double_tmp_result_k3Lzf6g = ((dpx * dqz) - (dpz * dqx));

double max3 = CGAL::abs(dpz);
Expand All @@ -117,28 +98,12 @@ class Collinear_3
else if (max3 > upper_bound_1)
upper_bound_1 = max3;

if (lower_bound_1 < 5.00368081960964635413e-147)
return Base::operator()(p, q, r);
else
{
if (upper_bound_1 > 1.67597599124282407923e+153)
return Base::operator()(p, q, r);

if ((lower_bound_1 >= 5.00368081960964635413e-147) && (upper_bound_1 <= 1.67597599124282407923e+153)) {
double eps = (8.88720573725927976811e-16 * (max1 * max3));
if (double_tmp_result_k3Lzf6g > eps)
int_tmp_result_3SPBwDj = 1;
else
{
if (double_tmp_result_k3Lzf6g < -eps)
int_tmp_result_3SPBwDj = -1;
else
return Base::operator()(p, q, r);
}
if (std::abs(double_tmp_result_k3Lzf6g) > eps)
return false;
}

int sign_of_determinant_return_value_FFWKCAA = int_tmp_result_3SPBwDj;

int int_tmp_result_Gx4H;
double double_tmp_result_AvrrXBP = ((dpy * dqz) - (dpz * dqy));

lower_bound_1 = max2;
Expand All @@ -149,26 +114,11 @@ class Collinear_3
else if (max3 > upper_bound_1)
upper_bound_1 = max3;

if (lower_bound_1 < 5.00368081960964635413e-147)
return Base::operator()(p, q, r);
else
{
if (upper_bound_1 > 1.67597599124282407923e+153)
return Base::operator()(p, q, r);

if ((lower_bound_1 >= 5.00368081960964635413e-147) && (upper_bound_1 <= 1.67597599124282407923e+153)) {
double eps = (8.88720573725927976811e-16 * (max2 * max3));
if (double_tmp_result_AvrrXBP > eps)
int_tmp_result_Gx4H = 1;
else
{
if (double_tmp_result_AvrrXBP < -eps)
int_tmp_result_Gx4H = -1;
else
return Base::operator()(p, q, r);
}
if (std::abs(double_tmp_result_AvrrXBP) > eps)
return false;
}
int sign_of_determinant_return_value_k60Ocge = int_tmp_result_Gx4H;
return ((sign_of_determinant_return_value_FFWKCAA == 0) && (sign_of_determinant_return_value_k60Ocge == 0));
}
return Base::operator()(p, q, r);
}
Expand Down