class Straightedge::Figures::Figure

TODO the idea is that a figure is a collection of marks (and possibly other figures…?)

marks should be represented relative to the *figural* origin

Attributes

color[RW]
location[RW]
marks[RW]

Public Class Methods

new(marks=[], location: nil, color: :none) click to toggle source
# File lib/straightedge/figures/figure.rb, line 17
def initialize(marks=[], location: nil, color: :none)
  @marks    = marks
  @color    = color
  @location = location
end

Public Instance Methods

adjacent() click to toggle source
# File lib/straightedge/figures/figure.rb, line 25
def adjacent
  approximate_adjacent = map(&method(:orbit)).flatten(1).uniq
  approximate_adjacent.reject(&method(:include?))
  #actual_adjacent.sort_by(&method(:distance_from_center))
end
center() click to toggle source

note this is center of the collection of raw marks

in terms of their own space; not displaced by location
or scaled by dimensions
# File lib/straightedge/figures/figure.rb, line 34
def center
  [map(&:x).mean, map(&:y).mean]
end
compass() click to toggle source
# File lib/straightedge/figures/figure.rb, line 23
def compass; @compass ||= Straightedge::Toolkit::Compass.default end