117: def polypoints(points)
118: case points.length
119: when 1
120: points = Array(points[0])
121: when 2
122: x_coords = Array(points[0])
123: y_coords = Array(points[1])
124: unless x_coords.length > 0 && y_coords.length > 0
125: raise ArgumentError, "array arguments must contain at least one point"
126: end
127: n = x_coords.length - y_coords.length
128: short = n > 0 ? y_coords : x_coords
129: olen = short.length
130: n.abs.times {|x| short << short[x % olen]}
131: points = x_coords.zip(y_coords).flatten
132: end
133: n = points.length
134: if n < 4 || n % 2 != 0
135: raise ArgumentError, "insufficient/odd number of points specified: #{n}"
136: end
137: return Magick::RVG.convert_to_float(*points)
138: end