Module: PerfectShape::MultiPoint

Included in:
CubicBezierCurve, Line, Path, Polygon, QuadraticBezierCurve
Defined in:
lib/perfect_shape/multi_point.rb

Overview

Represents multi-point shapes like Line, Polygon, and Polyline

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pointsObject

Returns the value of attribute points.



27
28
29
# File 'lib/perfect_shape/multi_point.rb', line 27

def points
  @points
end

Instance Method Details

#initialize(points: []) ⇒ Object



29
30
31
# File 'lib/perfect_shape/multi_point.rb', line 29

def initialize(points: [])
  self.points = points
end

#max_xObject



57
58
59
# File 'lib/perfect_shape/multi_point.rb', line 57

def max_x
  points.map(&:first).max
end

#max_yObject



61
62
63
# File 'lib/perfect_shape/multi_point.rb', line 61

def max_y
  points.map(&:last).max
end

#min_xObject



49
50
51
# File 'lib/perfect_shape/multi_point.rb', line 49

def min_x
  points.map(&:first).min
end

#min_yObject



53
54
55
# File 'lib/perfect_shape/multi_point.rb', line 53

def min_y
  points.map(&:last).min
end