diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2019-01-16 10:42:53 -0500 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2019-04-25 13:20:29 -0400 |
commit | b659e1eb2b732ebc836614735438ca0bcdc8a32d (patch) | |
tree | fdc9e58e4e573c08eb9004650476e43bc66a0e43 /editor | |
parent | c577ec6ae46f8c6d848cae46c0e447e6607b3f33 (diff) |
Use approximate equallity methods in many places
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_inspector.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/curve_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index b0a1331b2e..ecb9ea5f35 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -434,7 +434,7 @@ bool EditorPropertyRevert::is_node_property_different(Node *p_node, const Varian float a = p_current; float b = p_orig; - return Math::abs(a - b) > CMP_EPSILON; //this must be done because, as some scenes save as text, there might be a tiny difference in floats due to numerical error + return !Math::is_equal_approx(a, b); //this must be done because, as some scenes save as text, there might be a tiny difference in floats due to numerical error } return bool(Variant::evaluate(Variant::OP_NOT_EQUAL, p_current, p_orig)); diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 3d76b5da21..2c0dd5f1db 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -194,7 +194,7 @@ void CurveEditor::on_gui_input(const Ref<InputEvent> &p_event) { Vector2 dir = (control_pos - point_pos).normalized(); real_t tangent; - if (Math::abs(dir.x) > CMP_EPSILON) + if (!Math::is_zero_approx(dir.x)) tangent = dir.y / dir.x; else tangent = 9999 * (dir.y >= 0 ? 1 : -1); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 47f00dc480..603eca49d9 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2473,7 +2473,7 @@ void SpatialEditorViewport::_draw() { real_t max_speed = camera->get_zfar(); real_t scale_length = (max_speed - min_speed); - if (Math::abs(scale_length) > CMP_EPSILON) { + if (!Math::is_zero_approx(scale_length)) { real_t logscale_t = 1.0 - Math::log(1 + freelook_speed - min_speed) / Math::log(1 + scale_length); // There is no real maximum speed so that factor can become negative, @@ -2491,7 +2491,7 @@ void SpatialEditorViewport::_draw() { real_t max_distance = camera->get_zfar(); real_t scale_length = (max_distance - min_distance); - if (Math::abs(scale_length) > CMP_EPSILON) { + if (!Math::is_zero_approx(scale_length)) { real_t logscale_t = 1.0 - Math::log(1 + cursor.distance - min_distance) / Math::log(1 + scale_length); // There is no real maximum distance so that factor can become negative, |