Class: Pathby::Point

Inherits:
Struct
  • Object
show all
Includes:
Transformations
Defined in:
lib/pathby.rb,
lib/pathby.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Transformations

#center, #reflect, #rezero, #rotate, #scale, #scale_to, #simplebbox, #transform

Instance Attribute Details

#xObject

Returns the value of attribute x

Returns:

  • (Object)

    the current value of x



6
7
8
# File 'lib/pathby.rb', line 6

def x
  @x
end

#yObject

Returns the value of attribute y

Returns:

  • (Object)

    the current value of y



6
7
8
# File 'lib/pathby.rb', line 6

def y
  @y
end

Instance Method Details

#allpointsObject



17
18
19
# File 'lib/pathby.rb', line 17

def allpoints
  return [self]
end

#applytransform(m) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/pathby.rb', line 25

def applytransform(m)
  v = Matrix[[self.x],[self.y],[1]]
  v = m*v
  self.x = v[0,0]
  self.y = v[1,0]
  return self
end

#toPathDataObject



21
22
23
# File 'lib/pathby.rb', line 21

def toPathData
  return "#{'%.2f' % x} #{'%.2f' % y}"
end