Class: VectorSalad::StandardShapes::N

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::At

#[], #at, #at=, #move

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

#typeObject

Returns the value of attribute type.



12
13
14
# File 'lib/vector_salad/standard_shapes/n.rb', line 12

def type
  @type
end

#xObject

Returns the value of attribute x.



12
13
14
# File 'lib/vector_salad/standard_shapes/n.rb', line 12

def x
  @x
end

#yObject

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

.mObject



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