class RubyGL::Point
All Point
Operations Return New Points
Attributes
x[RW]
y[RW]
z[RW]
Public Class Methods
new(x, y, z = 0)
click to toggle source
# File lib/rubygl/geometry.rb, line 10 def initialize(x, y, z = 0) @x = x @y = y @z = z end
Public Instance Methods
*(point)
click to toggle source
# File lib/rubygl/geometry.rb, line 24 def *(point) Point.new(@x * point.x, @y * point.y, @z * point.z) end
+(point)
click to toggle source
# File lib/rubygl/geometry.rb, line 16 def +(point) Point.new(@x + point.x, @y + point.y, @z + point.z) end
-(point)
click to toggle source
# File lib/rubygl/geometry.rb, line 20 def -(point) Point.new(@x - point.x, @y - point.y, @z - point.z) end
distance(point)
click to toggle source
# File lib/rubygl/geometry.rb, line 32 def distance(point) temp = self - point Math::sqrt(temp.x * temp.x + temp.y * temp.y + temp.z * temp.z) end
midpoint(point)
click to toggle source
# File lib/rubygl/geometry.rb, line 38 def midpoint(point) Point.new((@x + point.x) * 0.5, (@y + point.y) * 0.5, (@z + point.z) * 0.5) end
scale(value)
click to toggle source
# File lib/rubygl/geometry.rb, line 28 def scale(value) Point.new(@x * value, @y * value, @z * value) end
to_a()
click to toggle source
# File lib/rubygl/geometry.rb, line 46 def to_a self.to_ary end
to_ary()
click to toggle source
# File lib/rubygl/geometry.rb, line 42 def to_ary [@x, @y, @z] end