Simplified expressions

This commit is contained in:
G Yuvan Shankar 2022-01-24 19:28:36 +05:30
parent 9001b744af
commit a2dd287a07
4 changed files with 19 additions and 19 deletions

View File

@ -111,9 +111,9 @@ linear_least_squares_fitting_2(InputIterator first,
// Translate the 2nd order moment calculated about the origin to
// the center of mass to get the covariance.
covariance[0] += -mass * (c.x() * c.x());
covariance[1] += -mass * (c.x() * c.y());
covariance[2] += -mass * (c.y() * c.y());
covariance[0] -= mass * (c.x() * c.x());
covariance[1] -= mass * (c.x() * c.y());
covariance[2] -= mass * (c.y() * c.y());
// solve for eigenvalues and eigenvectors.
// eigen values are sorted in ascending order,
@ -194,7 +194,7 @@ linear_least_squares_fitting_2(InputIterator first,
0.0, radius};
Matrix transformation = init_matrix<FT>(2,delta);
FT length = 2 * radius;
CGAL_assertion(length != 0.0);
CGAL_assertion(length != FT(0));
// Find the 2nd order moment for the circle wrt to the origin by an affine transformation.
@ -217,9 +217,9 @@ linear_least_squares_fitting_2(InputIterator first,
// Translate the 2nd order moment calculated about the origin to
// the center of mass to get the covariance.
covariance[0] += -mass * (c.x() * c.x());
covariance[1] += -mass * (c.x() * c.y());
covariance[2] += -mass * (c.y() * c.y());
covariance[0] -= mass * (c.x() * c.x());
covariance[1] -= mass * (c.x() * c.y());
covariance[2] -= mass * (c.y() * c.y());
// solve for eigenvalues and eigenvectors.
// eigen values are sorted in ascending order,

View File

@ -93,7 +93,7 @@ linear_least_squares_fitting_2(InputIterator first,
Matrix transformation = init_matrix<FT>(2,delta);
FT area = (x1-x0)*(y2-y0);
CGAL_assertion(area != 0.0);
CGAL_assertion(area != FT(0));
// Find the 2nd order moment for the rectangle wrt to the origin by an affine transformation.
@ -115,9 +115,9 @@ linear_least_squares_fitting_2(InputIterator first,
// Translate the 2nd order moment calculated about the origin to
// the center of mass to get the covariance.
covariance[0] += -mass * (c.x() * c.x());
covariance[1] += -mass * (c.x() * c.y());
covariance[2] += -mass * (c.y() * c.y());
covariance[0] -= mass * (c.x() * c.x());
covariance[1] -= mass * (c.x() * c.y());
covariance[2] -= mass * (c.y() * c.y());
// solve for eigenvalues and eigenvectors.
// eigen values are sorted in ascending order,

View File

@ -85,7 +85,7 @@ linear_least_squares_fitting_2(InputIterator first,
Matrix transformation = init_matrix<FT>(2,delta);
using std::sqrt;
FT length = CGAL::approximate_sqrt(t.squared_length());
CGAL_assertion(length != 0.0);
CGAL_assertion(length != FT(0));
// Find the 2nd order moment for the segment wrt to the origin by an affine transformation.
@ -104,9 +104,9 @@ linear_least_squares_fitting_2(InputIterator first,
// Translate the 2nd order moment calculated about the origin to
// the center of mass to get the covariance.
covariance[0] += -mass * ( c.x() * c.x());
covariance[1] += -mass * (c.x() * c.y());
covariance[2] += -mass * (c.y() * c.y());
covariance[0] -= mass * (c.x() * c.x());
covariance[1] -= mass * (c.x() * c.y());
covariance[2] -= mass * (c.y() * c.y());
// solve for eigenvalues and eigenvectors.
// eigen values are sorted in ascending order,

View File

@ -89,7 +89,7 @@ linear_least_squares_fitting_2(InputIterator first,
Matrix transformation = init_matrix<FT>(2,delta);
FT area = FT(0.5) * CGAL::abs(LA::determinant(transformation));
CGAL_assertion(area!=0);
CGAL_assertion(area!=FT(0));
// Find the 2nd order moment for the triangle wrt to the origin by an affine transformation.
@ -112,9 +112,9 @@ linear_least_squares_fitting_2(InputIterator first,
// Translate the 2nd order moment calculated about the origin to
// the center of mass to get the covariance.
covariance[0] += -mass * (c.x() * c.x());
covariance[1] += -mass * (c.x() * c.y());
covariance[2] += -mass * (c.y() * c.y());
covariance[0] -= mass * (c.x() * c.x());
covariance[1] -= mass * (c.x() * c.y());
covariance[2] -= mass * (c.y() * c.y());
// std::cout<<"cov: "<<covariance[0]*covariance[2]<<" =? "<<covariance[1]*covariance[1]<<std::endl;