spat v0.2.0 Spat.Geometry.Point
Link to this section Summary
Functions
Obtain the indexes of a point within the subdivided bounds
Check whether a point intersects with the given bounds (equal to or contained inside)
Link to this section Functions
Link to this function
index(point, bounds, subdivisions)
index(Spat.Coord.t(), Spat.Bounds.t(), pos_integer()) :: [Spat.grid_index()]
Obtain the indexes of a point within the subdivided bounds.
iex> Spat.Geometry.Point.index({ 0 }, Spat.Bounds.new({ 10 }), 1)
[[0]]
iex> Spat.Geometry.Point.index({ 5 }, Spat.Bounds.new({ 10 }), 1)
[[0], [1]]
iex> Spat.Geometry.Point.index({ 10 }, Spat.Bounds.new({ 10 }), 1)
[[1]]
iex> Spat.Geometry.Point.index({ -1 }, Spat.Bounds.new({ 10 }), 1)
[]
iex> Spat.Geometry.Point.index({ 2.5 }, Spat.Bounds.new({ 10 }), 1)
[[0]]
iex> Spat.Geometry.Point.index({ 2.5 }, Spat.Bounds.new({ 10 }), 2)
[[0, 0], [0, 1]]
iex> Spat.Geometry.Point.index({ 5, 5 }, Spat.Bounds.new({ 10, 10 }), 2)
[[0, 3], [1, 2], [2, 1], [3, 0]]
iex> Spat.Geometry.Point.index({ 2.5, 5 }, Spat.Bounds.new({ 10, 10 }), 2)
[[0, 2], [0, 3], [2, 0], [2, 1]]
iex> Spat.Geometry.Point.index({ 0, 0 }, Spat.Bounds.new({ 10, 10 }), 2)
[[0, 0]]
iex> Spat.Geometry.Point.index({ 12.5, 5 }, Spat.Bounds.new({ 10, 0 }, { 20, 10 }), 2)
[[0, 2], [0, 3], [2, 0], [2, 1]]
iex> Spat.Geometry.Point.index({ 10, 0 }, Spat.Bounds.new({ 10, 0 }, { 20, 10 }), 2)
[[0, 0]]
iex> Spat.Geometry.Point.index({ 0 }, Spat.Bounds.new({ -10 }, { 10 }), 1)
[[0], [1]]
iex> Spat.Geometry.Point.index({ -5 }, Spat.Bounds.new({ -10 }, { 10 }), 2)
[[0, 0], [0, 1]]
Check whether a point intersects with the given bounds (equal to or contained inside).