Class: Wx::RealPoint

Inherits:
Object
  • Object
show all
Includes:
FIRM::Serializable
Defined in:
lib/wx/shapes/wx.rb,
lib/wx/shapes/serialize/wx.rb

Instance Method Summary collapse

Instance Method Details

#distance_to(pt2) ⇒ Float Also known as: distance

Returns distance from this point to given point.

Parameters:

Returns:

  • (Float)

    distance 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

#to_sizeWx::Size

Returns this point as a Wx::Size

Returns:



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

def to_size
  Wx::Size.new(self.x.to_i, self.y.to_i)
end