Quadtreex.Node (quadtreex v0.2.1) View Source

A node in a quadtree

A quadtree node represents a bounded volume of 2 dimensional space.

Link to this section Summary

Link to this section Types

Specs

child_map() :: %{required(Quadtreex.BoundingBox.quadrant()) => t()}

Specs

create_option() :: min_size_option() | split_size_option() | parent_option()

Specs

create_options() :: [] | [create_option(), ...]

Specs

min_size_option() :: {:min_size, float()}

Specs

parent_option() :: {:parent, t()}

Specs

split_size_option() :: {:split_size, non_neg_integer()}

Specs

t() :: %Quadtreex.Node{
  bbox: Quadtreex.BoundingBox.t(),
  children: %{} | child_map(),
  entities: [] | [Quadtreex.Entity.t()],
  min_size: float(),
  parent: t() | nil,
  split_size: pos_integer()
}

Link to this section Functions

Specs

Specs

delete(t(), term()) :: {:ok, boolean(), t()}

Specs

height(t()) :: non_neg_integer()

Specs

insert(t(), Quadtreex.Entity.t()) :: {:ok, t()} | {:error, :out_of_bounds}
Link to this function

insert(node, location, thing)

View Source

Specs

insert(t(), Quadtreex.BoundingBox.coordinate(), term()) ::
  {:ok, t()} | {:error, :out_of_bounds}

Specs

is_root?(t()) :: boolean()
Link to this function

new(bbox, options \\ [])

View Source

Specs

Link to this function

range_query(node, point, max_distance)

View Source

Specs

range_query(t(), Quadtreex.BoundingBox.coordinate(), number()) :: [] | [term()]