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}]}}
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
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}]}}