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