Sha256: 47d58db4b5fad993743bccd6a5cbd859da0fb4a7d536606ab7dc6984d0d5033b
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
module Draught module Pathlike def points raise NotImplementedError, "Pathlike objects must return an array of their points" end def translate(vector) raise NotImplementedError, "Pathlike objects must implement translation by Vector" end def transform(transformation) raise NotImplementedError, "Pathlike objects must implement transformation by Affine transform or point-taking lambda" end def [](index_start_or_range, length = nil) raise NotImplementedError, "Pathlike objects must implement [] access on their points, returning a new instance" end def number_of_points points.length end def first points.first end def last points.last end def empty? points.empty? end def ==(other) return false if number_of_points != other.number_of_points points.zip(other.points).all? { |a, b| a == b } end def approximates?(other, delta) return false if number_of_points != other.number_of_points points.zip(other.points).all? { |a, b| a.approximates?(b, delta) } end def paths [] end def containers [] end def box_type [:path] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
draught-0.1.0 | lib/draught/pathlike.rb |