Sha256: b53f8c618deb289c4d24045eccc9ef6ecbb3674498ede59bcef91b46e7d4e215

Contents?: true

Size: 319 Bytes

Versions: 1

Compression:

Stored size: 319 Bytes

Contents

module Straightedge
  class Line
    attr_reader :color, :alpha, :beta
    def initialize(a,b,color=:black)
      @alpha, @beta = a, b
      @color = color
    end

    def dx
      @alpha.x - @beta.x
    end

    def dy
      @alpha.y - @beta.y
    end

    def length
      Math.sqrt(dx*dx + dy*dy)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
straightedge-0.1.0 lib/straightedge/line.rb