Module: GuiGeo::Tools

Extended by:
Tools
Includes:
GuiGeo
Included in:
Point, Rectangle, Tools
Defined in:
lib/gui_geometry/tools.rb

Constant Summary

Constants included from GuiGeo

VERSION

Instance Method Summary collapse

Methods included from GuiGeo

#point, #rect

Instance Method Details

#bound(a, bounded, c) ⇒ Object



13
# File 'lib/gui_geometry/tools.rb', line 13

def bound(a,bounded,c) max(a,min(bounded,c)); end

#clone_value(v) ⇒ Object



15
16
17
18
19
20
# File 'lib/gui_geometry/tools.rb', line 15

def clone_value(v)
  case v
  when Fixnum, Bignum, Float then v
  else v.clone
  end
end

#max(a, b) ⇒ Object



5
# File 'lib/gui_geometry/tools.rb', line 5

def max(a,b) a > b ? a : b; end

#min(a, b) ⇒ Object



4
# File 'lib/gui_geometry/tools.rb', line 4

def min(a,b) a < b ? a : b; end

#minmax(a, b) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/gui_geometry/tools.rb', line 6

def minmax(a,b)
  if a <= b
    return a, b
  else
    return b, a
  end
end