Class: Wicket::Coordinate
- Inherits:
-
Struct
- Object
- Struct
- Wicket::Coordinate
- Includes:
- Cartesian
- Defined in:
- lib/wicket/coordinate.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
-
#absolutize(delta_x, delta_y) ⇒ Object
method for a reference point to create absolute coords from relative measures.
- #reflect(remote) ⇒ Object
- #relativize(remote) ⇒ Object
Methods included from Cartesian
#distance_to, #to_svg, #to_wkt
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x
2 3 4 |
# File 'lib/wicket/coordinate.rb', line 2 def x @x end |
#y ⇒ Object
Returns the value of attribute y
2 3 4 |
# File 'lib/wicket/coordinate.rb', line 2 def y @y end |
Instance Method Details
#absolutize(delta_x, delta_y) ⇒ Object
method for a reference point to create absolute coords from relative measures.
7 8 9 |
# File 'lib/wicket/coordinate.rb', line 7 def absolutize(delta_x,delta_y) self.class.new(x + delta_x , y + delta_y) end |
#reflect(remote) ⇒ Object
15 16 17 18 |
# File 'lib/wicket/coordinate.rb', line 15 def reflect(remote) x,y = relativize(remote) absolutize(-x,-y) end |
#relativize(remote) ⇒ Object
11 12 13 |
# File 'lib/wicket/coordinate.rb', line 11 def relativize(remote) [remote.x - x, remote.y - y] end |