Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/gd2-ffij.rb

Instance Method Summary collapse

Instance Method Details

#degreesObject Also known as: degree

Express an angle in degrees, e.g. 90.degrees. Angles are converted to radians.


213
214
215
# File 'lib/gd2-ffij.rb', line 213

def degrees
  self * 2 * Math::PI / 360
end

#percentObject

Express a percentage, e.g. 50.percent. Percentages are floating point values, e.g. 0.5.


229
230
231
# File 'lib/gd2-ffij.rb', line 229

def percent
  self / 100.0
end

#to_degreesObject

Convert an angle (in radians) to degrees.


221
222
223
# File 'lib/gd2-ffij.rb', line 221

def to_degrees
  self * 360 / Math::PI / 2
end

#to_percentObject

Convert a number to a percentage value, e.g. 0.5 to 50.0.


236
237
238
# File 'lib/gd2-ffij.rb', line 236

def to_percent
  self * 100
end