Class: Preflight::Rules::MinPpi::Point
- Inherits:
-
Object
- Object
- Preflight::Rules::MinPpi::Point
- 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
-
#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.
159 160 161 |
# File 'lib/preflight/rules/min_ppi.rb', line 159 def initialize(x,y) @x, @y = x,y end |
Instance Attribute Details
#x ⇒ Object (readonly)
Returns the value of attribute x.
157 158 159 |
# File 'lib/preflight/rules/min_ppi.rb', line 157 def x @x end |
#y ⇒ Object (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 |