class Straightedge::Toolkit::Ruler

Attributes

unit[R]

Public Class Methods

default() click to toggle source
# File lib/straightedge/toolkit/ruler.rb, line 11
def default; @default ||= new end
distance(alpha,beta) click to toggle source
# File lib/straightedge/toolkit/ruler.rb, line 17
def distance(alpha,beta)
  Straightedge::Figures::Line.new([alpha,beta]).length
end
new(unit: 1) click to toggle source
# File lib/straightedge/toolkit/ruler.rb, line 6
def initialize(unit: 1)
  @unit = unit
end
translate(xy, dxy) click to toggle source
# File lib/straightedge/toolkit/ruler.rb, line 13
def translate(xy, dxy)
  xy.zip(dxy).map { |x,y| x+y }
end