chunky v0.13.0 Chunky.Geometry View Source

Functions for working with geometric shapes, patterns, and surfaces.

This module contains high level operations and guards for working with geometry.

See specific modules for more in depth functions:

Guards

  • is_triangle?/1 - Is the given parameter a 3-tuple of positive integers greater than 0?

Shape tests

Link to this section Summary

Functions

Is the shape of the given triangle valid?

Link to this section Functions

Link to this macro

is_triangle?(t)

View Source (macro)

Is the shape of the given triangle valid?

The is_triangle?/1 guard can only test for a limited set of properties. This function applies an additional set of constraints.

Examples

iex> Geometry.is_valid_triangle?({3, 4, 5})
true

iex> Geometry.is_valid_triangle?({5, 5, 5})
true

iex> Geometry.is_valid_triangle?({3, 4, 7})
false

iex> Geometry.is_valid_triangle?({10, 20, 40})
false