closeTo method
Check whether this transform is equal to other
, up to the given
tolerance
. Setting tolerance to zero will check for exact equality.
Transforms are considered equal if their rotation angles are the same
or differ by a multiple of 2π, and if all other transform parameters:
translation, scale, and offset are the same.
The tolerance
parameter is in absolute units, not relative.
Implementation
bool closeTo(Transform3D other, {double tolerance = 1e-10}) {
return (position.x - other.position.x).abs() <= tolerance &&
(position.y - other.position.y).abs() <= tolerance &&
(position.z - other.position.z).abs() <= tolerance &&
(rotation.x - other.rotation.x).abs() <= tolerance &&
(rotation.y - other.rotation.y).abs() <= tolerance &&
(rotation.z - other.rotation.z).abs() <= tolerance &&
(rotation.w - other.rotation.w).abs() <= tolerance &&
(scale.x - other.scale.x).abs() <= tolerance &&
(scale.y - other.scale.y).abs() <= tolerance &&
(scale.z - other.scale.z).abs() <= tolerance;
}