spat v0.3.0 Spat.Geometry.Box

Link to this section Summary

Functions

Obtain the indexes of a box within the subdivided bounds

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

Link to this section Functions

Link to this function index(min, max, bounds, subdivisions)

Obtain the indexes of a box within the subdivided bounds.

iex> Spat.Geometry.Box.index({ 0 }, { 1 }, Spat.Bounds.new({ 10 }), 1)
[[0]]

iex> Spat.Geometry.Box.index({ 5 }, { 6 }, Spat.Bounds.new({ 10 }), 1)
[[0], [1]]

iex> Spat.Geometry.Box.index({ 10 }, { 11 }, Spat.Bounds.new({ 10 }), 1)
[[1]]

iex> Spat.Geometry.Box.index({ -1 }, { -0.5 }, Spat.Bounds.new({ 10 }), 1)
[]

iex> Spat.Geometry.Box.index({ 2.5 }, { 3 }, Spat.Bounds.new({ 10 }), 1)
[[0]]

iex> Spat.Geometry.Box.index({ 2.5 }, { 3 }, Spat.Bounds.new({ 10 }), 2)
[[0, 0], [0, 1]]

iex> Spat.Geometry.Box.index({ 5, 5 }, { 6, 6 }, Spat.Bounds.new({ 10, 10 }), 2)
[[0, 3], [1, 2], [2, 1], [3, 0]]

iex> Spat.Geometry.Box.index({ 2.5, 5 }, { 3, 6 }, Spat.Bounds.new({ 10, 10 }), 2)
[[0, 2], [0, 3], [2, 0], [2, 1]]

iex> Spat.Geometry.Box.index({ 0, 0 }, { 1, 1 }, Spat.Bounds.new({ 10, 10 }), 2)
[[0, 0]]

iex> Spat.Geometry.Box.index({ 12.5, 5 }, { 13.5, 6 }, Spat.Bounds.new({ 10, 0 }, { 20, 10 }), 2)
[[0, 2], [0, 3], [2, 0], [2, 1]]

iex> Spat.Geometry.Box.index({ 10, 0 }, { 11, 1 }, Spat.Bounds.new({ 10, 0 }, { 20, 10 }), 2)
[[0, 0]]

iex> Spat.Geometry.Box.index({ 0 }, { 1 }, Spat.Bounds.new({ -10 }, { 10 }), 1)
[[0], [1]]

iex> Spat.Geometry.Box.index({ -5 }, { -4 }, Spat.Bounds.new({ -10 }, { 10 }), 2)
[[0, 0], [0, 1]]

iex> Spat.Geometry.Box.index({ 11, 1 }, { 50, 50 }, Spat.Bounds.new({ 10, 10 }), 2)
[]

iex> Spat.Geometry.Box.index({ -25, -25 }, { 50, 50 }, Spat.Bounds.new({ 10, 10 }), 2)
[[0, 0], [0, 1], [0, 2], [0, 3], [1, 0], [1, 1], [1, 2], [1, 3], [2, 0], [2, 1], [2, 2], [2, 3], [3, 0], [3, 1], [3, 2], [3, 3]]
Link to this function intersect(box_min, box_max, map)

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