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)

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]]
Link to this function intersect(point, map)
intersect(Spat.Coord.t(), Spat.Bounds.t()) :: boolean()

Check whether a point intersects with the given bounds (equal to or contained inside).