class EightCorner::Point

A point on a 2D plane.

Attributes

angle_from_last[RW]
angle_pct[RW]
bounds[RW]
created_by_potential[RW]
distance_from_last[RW]
distance_pct[RW]
x[RW]
y[RW]

Public Class Methods

new(x=nil, y=nil) click to toggle source
# File lib/eight_corner/point.rb, line 20
def initialize(x=nil, y=nil)
  @x = x
  @y = y
end

Public Instance Methods

==(other) click to toggle source
# File lib/eight_corner/point.rb, line 55
def ==(other)
  x == other.x && y == other.y
end
angle_range() click to toggle source
# File lib/eight_corner/point.rb, line 31
def angle_range
  Quadrant.angle_range_for(quadrant)
end
max() click to toggle source
# File lib/eight_corner/point.rb, line 47
def max
  [@x,@y].max
end
max_is() click to toggle source
# File lib/eight_corner/point.rb, line 51
def max_is
  @x > @y ? :x : :y
end
potential() click to toggle source

a single % value based on the data in this point used as an input for another Base#plot call TODO: what is distribution of values of this function? we want something reasonably gaussian, i think.

w/o created_by_potential, rearranging the initial string in a series of figures alters the first 10 figures or so, and then they eventually converge back to being identical. (The ~11th figure shows no dependence on this initial change in ordering.)

# File lib/eight_corner/point.rb, line 43
def potential
  (x/bounds.x.to_f + y/bounds.y.to_f + distance_pct.to_f + angle_pct.to_f + created_by_potential.to_f) % 1
end
quadrant() click to toggle source

which quadrant of the Bounds is this point in?

# File lib/eight_corner/point.rb, line 26
def quadrant
  raise "cannot calculate quadrant. bounds is nil" if bounds.nil?
  @quadrant ||= bounds.quadrant(self)
end
valid?() click to toggle source
# File lib/eight_corner/point.rb, line 59
def valid?
  x >= 0 && y >= 0 && x <= bounds.x && y <= bounds.y
end