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.
Attributes inherited from Triangle
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
79 80 81 82 |
# File 'lib/geometry/triangle.rb', line 79 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.
76 77 78 |
# File 'lib/geometry/triangle.rb', line 76 def base @base end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
76 77 78 |
# File 'lib/geometry/triangle.rb', line 76 def height @height end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
76 77 78 |
# File 'lib/geometry/triangle.rb', line 76 def origin @origin end |