Class: PDF::Reader::PageTextReceiver::Point
- Inherits:
-
Object
- Object
- PDF::Reader::PageTextReceiver::Point
- 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
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #distance(point) ⇒ Object
-
#initialize(x, y) ⇒ Point
constructor
A new instance of Point.
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
#x ⇒ Object (readonly)
Returns the value of attribute x.
266 267 268 |
# File 'lib/pdf/reader/page_text_receiver.rb', line 266 def x @x end |
#y ⇒ Object (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 |