Class: VectorSalad::StandardShapes::IsoTri
- Inherits:
-
BasicShape
- Object
- BasicShape
- VectorSalad::StandardShapes::IsoTri
- Includes:
- Mixins::At
- Defined in:
- lib/vector_salad/standard_shapes/iso_tri.rb
Overview
Isosceles or right-angle triangle shape.
Instance Attribute Summary (collapse)
-
- (Object) height
readonly
Returns the value of attribute height.
-
- (Object) options
inherited
from BasicShape
Returns the value of attribute options.
Instance Method Summary (collapse)
-
- (Any) [](x, y)
included
from Mixins::At
Set the x, y coordinates of the shape.
-
- (Coords) at
included
from Mixins::At
Get the x, y coordinates of the shape.
-
- (Any) at=(at)
included
from Mixins::At
Set the x, y coordinates of the shape directly.
-
- (IsoTri) initialize(width = nil, height, **options)
constructor
A new instance of IsoTri.
-
- (Any) move(x, y)
included
from Mixins::At
Move the shape relatively.
-
- (Object) to_path
Convert the shape to a path.
Constructor Details
- (IsoTri) initialize(width = nil, height, **options)
Returns a new instance of IsoTri
22 23 24 25 26 27 28 |
# File 'lib/vector_salad/standard_shapes/iso_tri.rb', line 22 def initialize(width = nil, height, **) width = height * 2 if width.nil? @width, @height = width, height @options = @x, @y = 0, 0 self end |
Instance Attribute Details
- (Object) height (readonly)
Returns the value of attribute height
12 13 14 |
# File 'lib/vector_salad/standard_shapes/iso_tri.rb', line 12 def height @height end |
- (Object) options Originally defined in class BasicShape
Returns the value of attribute options
Instance Method Details
- (Any) [](x, y) Originally defined in module Mixins::At
Set the x, y coordinates of the shape.
- (Coords) at Originally defined in module Mixins::At
Get the x, y coordinates of the shape.
- (Any) at=(at) Originally defined in module Mixins::At
Set the x, y coordinates of the shape directly.
- (Any) move(x, y) Originally defined in module Mixins::At
Move the shape relatively.
- (Object) to_path
Convert the shape to a path
31 32 33 34 35 36 37 38 |
# File 'lib/vector_salad/standard_shapes/iso_tri.rb', line 31 def to_path Path.new( N.n(@x, @y), N.n(@x - @width / 2, @y + @height), N.n(@x + @width / 2, @y + @height), **@options ) end |