Class: Geometry::PointSlopeLine

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(point, slope) ⇒ PointSlopeLine

Returns a new instance of PointSlopeLine.



93
94
95
96
# File 'lib/geometry/line.rb', line 93

def initialize(point, slope)
    @point = Point[point]
    @slope = slope
end

Instance Attribute Details

#slopeNumber (readonly)

Returns the slope of the Line.

Returns:

  • (Number)

    the slope of the Line



91
92
93
# File 'lib/geometry/line.rb', line 91

def slope
  @slope
end

Instance Method Details

#to_sObject



97
98
99
# File 'lib/geometry/line.rb', line 97

def to_s
    'Line(' + @slope.to_s + ',' + @point.to_s + ')'
end