stella v0.6.0 Cartesian

Cartesian 2D and 3D plane

Link to this section Summary

Functions

Determines in which octan on the three dimensional Cartesian plane point is located.

Determines in which quadrant on the two dimensional Cartesian plane point is located.

Orders points by distance between them. Returns 1 if A is nearer that B, else returns -1.

Orders points looking by x parametr value. Returns 1 if A is nearer thatn B, else returns -1.

Orders points looking by y parametr value. Returns 1 if A is nearer thatn B, else returns -1.

Orders points looking by z parametr value. Returns 1 if A is nearer thatn B, else returns -1.

Calculates the proximity to the nearest point. More info here

Link to this section Functions

Link to this function

determine_octan(point)

Specs

determine_octan(map()) :: nil | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7

Determines in which octan on the three dimensional Cartesian plane point is located.

print image

Examples

iex> Cartesian.determine_octan(%{x: 1, y: 2, z: 3})
0

iex> Cartesian.determine_octan(%{x: 0, y: 0, z: 3})
nil
Link to this function

determine_quadrant(point)

Specs

determine_quadrant(map()) :: nil | 1 | 2 | 3 | 4

Determines in which quadrant on the two dimensional Cartesian plane point is located.

print image

Examples

iex> Cartesian.determine_quadrant(%{x: 1, y: 2})
1

iex> Cartesian.determine_quadrant(%{x: 1.06, y: 2.12})
1

iex> Cartesian.determine_quadrant(%{x: -0.06, y: 2.12})
2

iex> Cartesian.determine_quadrant(%{x: 0, y: 0})
nil
Link to this function

order_by_distance(point_a, point_b)

Specs

order_by_distance(map(), map()) :: -1 | 1

Orders points by distance between them. Returns 1 if A is nearer that B, else returns -1.

Examples

iex> Cartesian.order_by_distance(%{x: 1, y: 2, z: 3}, %{x: 2, y: 2, z: 3})
-1
Link to this function

order_by_x(point_a, point_b)

Specs

order_by_x(map(), map()) :: -1 | 1

Orders points looking by x parametr value. Returns 1 if A is nearer thatn B, else returns -1.

Examples

iex> Cartesian.order_by_x(%{x: 1, y: 2, z: 3}, %{x: 2, y: 2, z: 3})
-1
Link to this function

order_by_y(point_a, point_b)

Specs

order_by_y(map(), map()) :: -1 | 1

Orders points looking by y parametr value. Returns 1 if A is nearer thatn B, else returns -1.

Examples

iex> Cartesian.order_by_y(%{x: 1, y: 2, z: 3}, %{x: 2, y: 2, z: 3})
1
Link to this function

order_by_z(point_a, point_b)

Specs

order_by_z(map(), map()) :: -1 | 1

Orders points looking by z parametr value. Returns 1 if A is nearer thatn B, else returns -1.

Examples

iex> Cartesian.order_by_z(%{x: 1, y: 2, z: 3}, %{x: 2, y: 2, z: 3})
1
Link to this function

proximity(point)

Specs

proximity(map()) :: number()

Calculates the proximity to the nearest point. More info here

Examples

iex> Cartesian.proximity(%{x: 1, y: 2, z: 3})
6