Class: VectorSalad::StandardShapes::N
- Inherits:
-
Object
- Object
- VectorSalad::StandardShapes::N
- Includes:
- Mixins::At
- Defined in:
- lib/vector_salad/standard_shapes/n.rb
Overview
N node. A node is the simplest primitive but useless on its own. Use nodes to build up a path (see Path). A node is a point in space with x and y coordinates.
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Class Method Summary collapse
- .c(x, y) ⇒ Object
- .g(x, y) ⇒ Object
- .l(x, y) ⇒ Object
- .m ⇒ Object
- .n(x, y, type = :node) ⇒ Object
- .q(x, y) ⇒ Object
- .r(x, y) ⇒ Object
- .s(x, y) ⇒ Object
Instance Method Summary collapse
-
#initialize(x, y, type = :node) ⇒ N
constructor
A new instance of N.
Methods included from Mixins::At
Constructor Details
#initialize(x, y, type = :node) ⇒ N
Returns a new instance of N.
15 16 17 18 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 15 def initialize(x, y, type) create(x, y, type) self end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
12 13 14 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 12 def type @type end |
#x ⇒ Object
Returns the value of attribute x.
12 13 14 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 12 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
12 13 14 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 12 def y @y end |
Class Method Details
.c(x, y) ⇒ Object
62 63 64 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 62 def self.c(x, y) new(x, y, :cubic) end |
.g(x, y) ⇒ Object
90 91 92 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 90 def self.g(x, y) new(x, y, :g4) end |
.l(x, y) ⇒ Object
104 105 106 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 104 def self.l(x, y) new(x, y, :left) end |
.m ⇒ Object
51 52 53 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 51 def self.m new(nil, nil, :mirror) end |
.n(x, y, type = :node) ⇒ Object
43 44 45 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 43 def self.n(x, y, type = :node) new(x, y, type) end |
.q(x, y) ⇒ Object
72 73 74 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 72 def self.q(x, y) new(x, y, :quadratic) end |
.r(x, y) ⇒ Object
97 98 99 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 97 def self.r(x, y) new(x, y, :right) end |
.s(x, y) ⇒ Object
82 83 84 |
# File 'lib/vector_salad/standard_shapes/n.rb', line 82 def self.s(x, y) new(x, y, :g2) end |