Class: NSWTopo::GeoJSON::MultiPoint

Inherits:
Object
  • Object
show all
Defined in:
lib/nswtopo/gis/geojson/multi_point.rb

Instance Method Summary collapse

Instance Method Details

#clip(hull) ⇒ Object



4
5
6
7
8
9
# File 'lib/nswtopo/gis/geojson/multi_point.rb', line 4

def clip(hull)
  points = [hull, hull.perps].transpose.inject(@coordinates) do |result, (vertex, perp)|
    result.select { |point| point.minus(vertex).dot(perp) >= 0 }
  end
  points.none? ? nil : points.one? ? Point.new(*points, @properties) : MultiPoint.new(points, @properties)
end