Class: Wx::RealPoint
- Inherits:
-
Object
- Object
- Wx::RealPoint
- Includes:
- FIRM::Serializable
- Defined in:
- lib/wx/shapes/wx.rb,
lib/wx/shapes/serialize/wx.rb
Instance Method Summary collapse
-
#distance_to(pt2) ⇒ Float
(also: #distance)
Returns distance from this point to given point.
-
#to_size ⇒ Wx::Size
Returns this point as a Wx::Size.
Instance Method Details
#distance_to(pt2) ⇒ Float Also known as: distance
Returns distance from this point to given point.
11 12 13 14 15 16 |
# File 'lib/wx/shapes/wx.rb', line 11 def distance_to(pt2) to_x, to_y = pt2 to_x = to_x.to_f to_y = to_y.to_f Math.sqrt((to_x - self.x)*(to_x - self.x) + (to_y - self.y)*(to_y - self.y)) end |