geometrex v0.1.1 Point

This module uses two-dimentional coordinates in Cartesian coordinate system.

Link to this section Summary

Types

t()

Type that represents Point struct with :x and :y as number.

Point:x:y

Functions

new vector from two number

Examples

iex> Point.new(1, 1)
%Point{x: 1, y: 1}

new vector from two vector and sort. output a is near by origin than b.

Examples

iex> Point.new_sort( Point.new(1, 0), Point.new(0, 0))
[%Point{x: 0, y: 0}, %Point{x: 1, y: 0}]

Calculate Vector from two vector

Calculate norum of “one” vector

Calculate norum of “two” vector

Subtract Vector from two vector

Link to this section Types

Link to this type t()
t() :: %Point{x: float(), y: float()}
Link to this type t(x, y)
t(x, y) :: %Point{x: x, y: y}
Type that represents Point struct with :x and :y as number.  
Point:x:y

Link to this section Functions

Link to this function new(a, b)
new(float() | integer(), float() | integer()) :: Point.t()

new vector from two number

Examples

iex> Point.new(1, 1)
%Point{x: 1, y: 1}
Link to this function new_sort(a, b)
new_sort(Point.t(), Point.t()) :: [Point.t()]

new vector from two vector and sort. output a is near by origin than b.

Examples

iex> Point.new_sort( Point.new(1, 0), Point.new(0, 0))
[%Point{x: 0, y: 0}, %Point{x: 1, y: 0}]
Link to this function new_vector(a, b)
new_vector(Point.t(), Point.t()) :: Point.t()

Calculate Vector from two vector.

Examples

iex> Point.new_vector( %Point{x: 2, y: 2}, %Point{x: 1, y: 1} )
%Point{x: 1, y: 1}
Link to this function nrm(point)
nrm(Point.t()) :: float()

Calculate norum of “one” vector

Examples

iex> Point.nrm(Point.new(1, 1))
1.4142135623730951
Link to this function nrm(point1, point2)
nrm(Point.t(), Point.t()) :: float()

Calculate norum of “two” vector

Examples

iex> Point.nrm(Point.new(0, 0), Point.new(1, 1))
1.4142135623730951
Link to this function sub(point1, point2)
sub(Point.t(), Point.t()) :: Point.t()

Subtract Vector from two vector.

Examples

iex> Point.sub( %Point{x: 2, y: 2}, %Point{x: 1, y: 1} )
%Point{x: -1, y: -1}