Sha256: 064ef872141e00abca7e241cdd6009e89fc8e6692c865356d42b0de1a125a3cf

Contents?: true

Size: 367 Bytes

Versions: 2

Compression:

Stored size: 367 Bytes

Contents

module Straightedge
  module Toolkit
    class Ruler
      attr_reader :unit

      def initialize(unit: 1)
	@unit = unit
      end

      class << self
	def default; @default ||= new end

	def translate(xy, dxy)
	  xy.zip(dxy).map { |x,y| x+y }
	end

	def distance(alpha,beta)
	  Straightedge::Figures::Line.new([alpha,beta]).length
	end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
straightedge-0.1.2 lib/straightedge/toolkit/ruler.rb
straightedge-0.1.1 lib/straightedge/toolkit/ruler.rb