Method: Autocad::Point3d.pts_to_array
- Defined in:
- lib/autocad/point3d.rb
.pts_to_array(pts) ⇒ Object
convert array of points to array of x,y coordinates array can be [ Point3d, Point3d, ..] array can be [ [x,y,z], [x,y,z], [x,y,z] ..] array can be [x,y, x1, y1, x2,y2, x3,y3] array can be [[x,y], [x2,y2], [x3,y3]] all coordinates are converted to float z coordinates are ignored
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/autocad/point3d.rb', line 35 def pts_to_array(pts) case pts.first when Point3d pts.flat_map(&:to_xy) when Array pts.flat_map { |pt| [pt[0].to_f, pt[1].to_f] } when Numeric pts.each_slice(2).flat_map { |x, y| [x.to_f, y.to_f] } end end |