Class: Geometry::RightTriangle
- Defined in:
- lib/geometry/triangle.rb
Overview
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
Instance Method Summary collapse
-
#initialize(origin, base, height) ⇒ RightTriangle
constructor
Construct a Right Triangle given a Point and the leg lengths.
-
#points ⇒ Array<Point>
An array of points corresponding to the vertices of the Triangle (clockwise).
Methods inherited from Triangle
Methods included from ClusterFactory
Constructor Details
#initialize(origin, base, height) ⇒ RightTriangle
Construct a Right Triangle given a Point and the leg lengths
58 59 60 61 |
# File 'lib/geometry/triangle.rb', line 58 def initialize(origin, base, height) @origin = Point[origin] @base, @height = base, height end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
55 56 57 |
# File 'lib/geometry/triangle.rb', line 55 def base @base end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
55 56 57 |
# File 'lib/geometry/triangle.rb', line 55 def height @height end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
55 56 57 |
# File 'lib/geometry/triangle.rb', line 55 def origin @origin end |