Class: PDF::Reader::PageTextReceiver::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/pdf/reader/page_text_receiver.rb

Overview

private class for representing points on a cartesian plain. Used to simplify maths in the MinPpi class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y) ⇒ Point

Returns a new instance of Point.



268
269
270
# File 'lib/pdf/reader/page_text_receiver.rb', line 268

def initialize(x,y)
  @x, @y = x,y
end

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



266
267
268
# File 'lib/pdf/reader/page_text_receiver.rb', line 266

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



266
267
268
# File 'lib/pdf/reader/page_text_receiver.rb', line 266

def y
  @y
end

Instance Method Details

#distance(point) ⇒ Object



272
273
274
# File 'lib/pdf/reader/page_text_receiver.rb', line 272

def distance(point)
  Math.hypot(point.x - x, point.y - y)
end