vivid v0.1.1 Vivid.Point

Represents an individual point in (2D) space.

Summary

Functions

Creates a Point

Round the coordinates in the point to the nearest integer value

Simple helper to swap X and Y coordinates - used when translating the frame buffer to vertical

Return the vector in x and y between point a and point b

Returns the X coordinate of the point

Returns the Y coordinate of the point

Functions

init(x, y)

Creates a Point.

Examples

iex> Vivid.Point.init(13, 27)
%Vivid.Point{x: 13, y: 27}
round(point)

Round the coordinates in the point to the nearest integer value.

Example

iex> Vivid.Point.init(1.23, 4.56)
...> |> Vivid.Point.round
#Vivid.Point<{1, 5}>
swap_xy(point)

Simple helper to swap X and Y coordinates - used when translating the frame buffer to vertical.

vector(point1, point2)

Return the vector in x and y between point a and point b.

x(point)

Returns the X coordinate of the point.

Examples

iex> Vivid.Point.init(13, 27) |> Vivid.Point.x
13
y(point)

Returns the Y coordinate of the point.

Examples

iex> Vivid.Point.init(13, 27) |> Vivid.Point.y
27