-
Notifications
You must be signed in to change notification settings - Fork 146
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
Fix #522: More robust rotation checking in egs++ transformations #525
Conversation
Please provide a more descriptive comment for this pull request, @jw3126, perhaps including why this fix is necessary. |
@blakewalters there's more description in the issue, #522. Essentially the check against the identity matrix could fail due to floating point errors. |
@blakewalters You want me to expand the commit message? |
@blakewalters |
Perfect, @jw3126. Thanks! |
Our commit title format for fixing issues is |
6b1ade5
to
3ed5116
Compare
Adjusted the commit message, and updated the logic to test component-by-component. This is more verbose, but it is clearer and on average more efficient, arguably! |
Reduce the value of the egs++ floating-point epsilon from 10e-10 to a value that is 4 times (2 bits away) from the true machine epsilon, and appropriately for single and double precision versions of the code. Add a distanceEpsilon constant that is independent of the machine epsilon, and much larger, but still entirely sufficient for physical dimensions (well below atomic dimensions in double precision). By default, the base geometry sets its boundaryTolerance to this constant. Its value is close to the previous value of epsilon (1e-10), which should curb any change in floating point error triggers in the geometry library at this point. Earlier in #177, the epsilon constant was introduced to remove hard-coded floating point comparison guards. The 1e-10 value was chosen because it matched most of the hard-coded values in the geometry library. However, this epsilon is now starting to be used as a general float guard (see #525 for example), where 1e-10 is not appropriate, as it effectively reduces the floating-point precision of the computation. Hence the need for independent epsilon values for computations and for geometrical purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks clean and correct to me.
Cleaned up the branch and adjusted commit messages. Keep this as two separate commits on side branch when merging in, to preserve the original commit by @jw3126. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a bit more info regarding this pull request:
Rotation matrices are square matrices, with real entries. More specifically, they can be characterized as orthogonal matrices with determinant 1; that is, a square matrix R is a rotation matrix if and only if RT = R−1 and det R = 1.
From Wikipedia's definition of a rotation matrix.
The comparisons with |
Provide floating-point error margins in testing whether or not a matrix is the identity matrix. This is done on a component by component basis. Previously, matrix components were compared with exactly '0' and '1', so the test could fail on account of roundoff errors on the components.
Reduce the value of the egs++ floating-point epsilon from 10e-10 to a value that is 4 times (2 bits away) from the true machine epsilon, and appropriately for single and double precision versions of the code. Add a distanceEpsilon constant that is independent of the machine epsilon, and much larger, but still entirely sufficient for physical dimensions (well below atomic dimensions in double precision). By default, the base geometry sets its boundaryTolerance to this constant. Its value is close to the previous value of epsilon (1e-10), which should curb any change in floating point error triggers in the geometry library at this point. Earlier in #177, the epsilon constant was introduced to remove hard-coded floating point comparison guards. The 1e-10 value was chosen because it matched most of the hard-coded values in the geometry library. However, this epsilon is now starting to be used as a general float guard (see #525 for example), where 1e-10 is not appropriate, as it effectively reduces the floating-point precision of the computation. Hence the need for independent epsilon values for computations and for geometrical purposes.
Reduce the value of the egs++ floating-point epsilon from 10e-10 to a value that is 4 times (2 bits away) from the true machine epsilon, and appropriately for single and double precision versions of the code. Add a distanceEpsilon constant that is independent of the machine epsilon, and much larger, but still entirely sufficient for physical dimensions (well below atomic dimensions in double precision). By default, the base geometry sets its boundaryTolerance to this constant. Its value is close to the previous value of epsilon (1e-10), which should curb any change in floating point error triggers in the geometry library at this point. Earlier in #177, the epsilon constant was introduced to remove hard-coded floating point comparison guards. The 1e-10 value was chosen because it matched most of the hard-coded values in the geometry library. However, this epsilon is now starting to be used as a general float guard (see #525 for example), where 1e-10 is not appropriate, as it effectively reduces the floating-point precision of the computation. Hence the need for independent epsilon values for computations and for geometrical purposes.
Reduce the value of the egs++ floating-point epsilon from 10e-10 to a value that is 4 times (2 bits away) from the true machine epsilon, and appropriately for single and double precision versions of the code. Add a distanceEpsilon constant that is independent of the machine epsilon, and much larger, but still entirely sufficient for physical dimensions (well below atomic dimensions in double precision). By default, the base geometry sets its boundaryTolerance to this constant. Its value is close to the previous value of epsilon (1e-10), which should curb any change in floating point error triggers in the geometry library at this point. Earlier in #177, the epsilon constant was introduced to remove hard-coded floating point comparison guards. The 1e-10 value was chosen because it matched most of the hard-coded values in the geometry library. However, this epsilon is now starting to be used as a general float guard (see #525 for example), where 1e-10 is not appropriate, as it effectively reduces the floating-point precision of the computation. Hence the need for independent epsilon values for computations and for geometrical purposes.
Reduce the value of the egs++ floating-point epsilon from 10e-10 to a value that is 4 times (2 bits away) from the true machine epsilon, and appropriately for single and double precision versions of the code. Add a distanceEpsilon constant that is independent of the machine epsilon, and much larger, but still entirely sufficient for physical dimensions (well below atomic dimensions in double precision). By default, the base geometry sets its boundaryTolerance to this constant. Its value is close to the previous value of epsilon (1e-10), which should curb any change in floating point error triggers in the geometry library at this point. Earlier in #177, the epsilon constant was introduced to remove hard-coded floating point comparison guards. The 1e-10 value was chosen because it matched most of the hard-coded values in the geometry library. However, this epsilon is now starting to be used as a general float guard (see #525 for example), where 1e-10 is not appropriate, as it effectively reduces the floating-point precision of the computation. Hence the need for independent epsilon values for computations and for geometrical purposes.
Reduce the value of the egs++ floating-point epsilon from 10e-10 to a value that is 4 times (2 bits away) from the true machine epsilon, and appropriately for single and double precision versions of the code. Add a distanceEpsilon constant that is independent of the machine epsilon, and much larger, but still entirely sufficient for physical dimensions (well below atomic dimensions in double precision). By default, the base geometry sets its boundaryTolerance to this constant. Its value is close to the previous value of epsilon (1e-10), which should curb any change in floating point error triggers in the geometry library at this point. Earlier in #177, the epsilon constant was introduced to remove hard-coded floating point comparison guards. The 1e-10 value was chosen because it matched most of the hard-coded values in the geometry library. However, this epsilon is now starting to be used as a general float guard (see #525 for example), where 1e-10 is not appropriate, as it effectively reduces the floating-point precision of the computation. Hence the need for independent epsilon values for computations and for geometrical purposes.
No description provided.