Class: Preflight::Rules::MinPpi::Point

Inherits:
Object
  • Object
show all
Defined in:
lib/preflight/rules/min_ppi.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.



159
160
161
# File 'lib/preflight/rules/min_ppi.rb', line 159

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

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



157
158
159
# File 'lib/preflight/rules/min_ppi.rb', line 157

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



157
158
159
# File 'lib/preflight/rules/min_ppi.rb', line 157

def y
  @y
end

Instance Method Details

#distance(point) ⇒ Object



163
164
165
# File 'lib/preflight/rules/min_ppi.rb', line 163

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