Class: Rubyvis::Transform
Instance Attribute Summary collapse
-
#k ⇒ Object
Returns the value of attribute k.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Transform
constructor
A new instance of Transform.
- #translate(x, y) ⇒ Object
Constructor Details
#initialize ⇒ Transform
Returns a new instance of Transform.
7 8 9 10 11 |
# File 'lib/rubyvis/transform.rb', line 7 def initialize @k=1 @x=0 @y=0 end |
Instance Attribute Details
#k ⇒ Object
Returns the value of attribute k.
6 7 8 |
# File 'lib/rubyvis/transform.rb', line 6 def k @k end |
#x ⇒ Object
Returns the value of attribute x.
6 7 8 |
# File 'lib/rubyvis/transform.rb', line 6 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
6 7 8 |
# File 'lib/rubyvis/transform.rb', line 6 def y @y end |
Class Method Details
Instance Method Details
#translate(x, y) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/rubyvis/transform.rb', line 12 def translate(x,y) v=Transform.new v.k=self.k v.x=self.k*x+self.x v.y=self.k*y+self.y v end |