module Geom2D::Utils
Contains utility methods and classes.
Attributes
precision[RW]
Private Instance Methods
float_compare(a, b)
click to toggle source
Compares two floats like the <=> operator but using the set precision for detecting whether they are equal.
# File lib/geom2d/utils.rb, line 32 def float_compare(a, b) result = a - b (result.abs < Utils.precision ? 0 : a <=> b) end
float_equal(a, b)
click to toggle source
Compares two float whether they are equal using the set precision.
# File lib/geom2d/utils.rb, line 26 def float_equal(a, b) (a - b).abs < Utils.precision end