View Source Vivid.Transform.Point (vivid v0.4.4)

Standard transformations which can be applied to points without knowing the details of the geometry.

Used extensively by Transform, however you can use these functions as input to the Transformable protocol, should you require.

Summary

Functions

Rotate point degrees around an origin point.

Rotate point radians around an origin point.

Scale point (ie move it) by multiplying it's distance from the 0, 0 point by x_factor and y_factor.

Scale point (ie move it) by multiplying it's distance from the origin point by x_factor and y_factor.

Translate point (ie move it) by adding x and y to it's coordinates.

Types

@type degrees() :: number()
@type radians() :: number()

Functions

Link to this function

rotate(point, origin, degrees)

View Source
@spec rotate(Vivid.Point.t(), Vivid.Point.t(), degrees()) :: Vivid.Point.t()

Rotate point degrees around an origin point.

Link to this function

rotate_radians(point, origin, radians)

View Source
@spec rotate_radians(Vivid.Point.t(), Vivid.Point.t(), radians()) :: Vivid.Point.t()

Rotate point radians around an origin point.

Link to this function

scale(point, x_factor, y_factor)

View Source
@spec scale(Vivid.Point.t(), number(), number()) :: Vivid.Point.t()

Scale point (ie move it) by multiplying it's distance from the 0, 0 point by x_factor and y_factor.

Link to this function

scale(point, x_factor, y_factor, origin)

View Source
@spec scale(Vivid.Point.t(), number(), number(), Vivid.Point.t()) :: Vivid.Point.t()

Scale point (ie move it) by multiplying it's distance from the origin point by x_factor and y_factor.

@spec translate(Vivid.Point.t(), number(), number()) :: Vivid.Point.t()

Translate point (ie move it) by adding x and y to it's coordinates.