Class: Geometry::TwoPointLine

Inherits:
Line
  • Object
show all
Defined in:
lib/geometry/line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Line

[], horizontal, new, vertical

Methods included from ClusterFactory

included

Constructor Details

#initialize(point0, point1) ⇒ TwoPointLine

Returns a new instance of TwoPointLine.



134
135
136
# File 'lib/geometry/line.rb', line 134

def initialize(point0, point1)
    @first, @last = [Point[point0], Point[point1]]
end

Instance Attribute Details

#firstObject (readonly)

Returns the value of attribute first.



132
133
134
# File 'lib/geometry/line.rb', line 132

def first
  @first
end

#lastObject (readonly)

Returns the value of attribute last.



132
133
134
# File 'lib/geometry/line.rb', line 132

def last
  @last
end

Instance Method Details

#inspectObject Also known as: to_s



137
138
139
# File 'lib/geometry/line.rb', line 137

def inspect
    'Line(' + @first.inspect + ', ' + @last.inspect + ')'
end