geo_partition v0.1.1 GeoPartition.Partition View Source

Link to this section Summary

Functions

Examples

iex> ring = [{1, 2}, {5, 5}, {2, 1}, {1, 1}, {1, 2}]
iex> GeoPartition.Partition.add_split(ring)
{:ok, {[{1, 2}, {5, 5}, {2, 1}, {1, 2}], [{2, 1}, {1, 1}, {1, 2}, {2, 1}]}}

Tests if a given pair of vertices form an acceptable split of a ring

Once a safe split is identified, make the split

Link to this section Functions

Examples

iex> ring = [{1, 2}, {5, 5}, {2, 1}, {1, 1}, {1, 2}]
iex> GeoPartition.Partition.add_split(ring)
{:ok, {[{1, 2}, {5, 5}, {2, 1}, {1, 2}], [{2, 1}, {1, 1}, {1, 2}, {2, 1}]}}
Link to this function add_split_triangle(ring) View Source
Link to this function good_line(ring, source, target) View Source

Tests if a given pair of vertices form an acceptable split of a ring

Examples

iex> ring = [{1, 1}, {2, 0}, {3, 1}, {2, 2}, {1, 1}]
iex> GeoPartition.Partition.good_line(ring, 1, 3)
true


iex> ring = [{1, 1}, {2, 0}, {3, 1}, {2, 2}, {1, 1}]
iex> GeoPartition.Partition.good_line(ring, 1, 2)
false

iex> ring = [{2, 0}, {0, 1}, {0, 2}, {2, 4}, {1, 2}, {1, 1}, {2, 1}, {2, 0}]
iex> GeoPartition.Partition.good_line(ring, 0, 3)
false
Link to this function make_split(ring, source, target) View Source

Once a safe split is identified, make the split

Examples

iex> ring = [{1, 1}, {2, 0}, {3, 1}, {2, 2}, {1, 1}]
iex> GeoPartition.Partition.make_split(ring, 1, 3)
{:ok, {[{2, 0}, {3, 1}, {2, 2}, {2, 0}], [{2, 2}, {1, 1}, {2, 0}, {2, 2}]}}
Link to this function maybe_split(polygon, max_area) View Source
Link to this function partition(shape, max_area) View Source
Link to this function partition_list(list_of_polys, max_area) View Source