module Draught::Pathlike
Public Instance Methods
==(other)
click to toggle source
# File lib/draught/pathlike.rb, line 35 def ==(other) return false if number_of_points != other.number_of_points points.zip(other.points).all? { |a, b| a == b } end
[](index_start_or_range, length = nil)
click to toggle source
# File lib/draught/pathlike.rb, line 15 def [](index_start_or_range, length = nil) raise NotImplementedError, "Pathlike objects must implement [] access on their points, returning a new instance" end
approximates?(other, delta)
click to toggle source
# File lib/draught/pathlike.rb, line 40 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
box_type()
click to toggle source
# File lib/draught/pathlike.rb, line 53 def box_type [:path] end
containers()
click to toggle source
# File lib/draught/pathlike.rb, line 49 def containers [] end
empty?()
click to toggle source
# File lib/draught/pathlike.rb, line 31 def empty? points.empty? end
first()
click to toggle source
# File lib/draught/pathlike.rb, line 23 def first points.first end
last()
click to toggle source
# File lib/draught/pathlike.rb, line 27 def last points.last end
number_of_points()
click to toggle source
# File lib/draught/pathlike.rb, line 19 def number_of_points points.length end
paths()
click to toggle source
# File lib/draught/pathlike.rb, line 45 def paths [] end
points()
click to toggle source
# File lib/draught/pathlike.rb, line 3 def points raise NotImplementedError, "Pathlike objects must return an array of their points" end
transform(transformation)
click to toggle source
# File lib/draught/pathlike.rb, line 11 def transform(transformation) raise NotImplementedError, "Pathlike objects must implement transformation by Affine transform or point-taking lambda" end
translate(vector)
click to toggle source
# File lib/draught/pathlike.rb, line 7 def translate(vector) raise NotImplementedError, "Pathlike objects must implement translation by Vector" end