# module Geode

## Overview

Mathematics library supporting vectors, matrices, quaternions, and more.

## Defined in:

geode.cr
geode/angles/angle.cr
geode/angles/comparison.cr
geode/angles/degrees.cr
geode/angles/operations.cr
geode/angles/turns.cr
geode/matrices.cr
geode/matrices/base.cr
geode/matrices/common.cr
geode/matrices/comparison.cr
geode/matrices/iterators.cr
geode/matrices/matrix.cr
geode/matrices/matrix1.cr
geode/matrices/matrix2.cr
geode/matrices/matrix3.cr
geode/matrices/matrix4.cr
geode/matrices/operations.cr
geode/matrices/projections.cr
geode/matrices/square.cr
geode/matrices/transforms2d.cr
geode/matrices/transforms3d.cr
geode/matrices/vectors.cr
geode/points/point.cr
geode/points/point1.cr
geode/points/point2.cr
geode/points/point3.cr
geode/points/point4.cr
geode/vectors.cr
geode/vectors/base.cr
geode/vectors/common.cr
geode/vectors/comparison.cr
geode/vectors/geometry.cr
geode/vectors/matrices.cr
geode/vectors/operations.cr
geode/vectors/vector.cr
geode/vectors/vector1.cr
geode/vectors/vector2.cr
geode/vectors/vector3.cr
geode/vectors/vector4.cr

## Constant Summary

VERSION = `{{ (`shards version \"/builds/arctic-fox/geode/src\"`).stringify.chomp }}`

Current version of the Geode library.

## Class Method Detail

def self.edge(value : T, edge) forall T #

Returns 0 if the value is less than the edge value or 1 if it's greater.

``````0.edge(1) # => 0
2.edge(1) # => 1``````

def self.lerp(a, b, t : Number) #

Calculates the linear interpolation between two values.

t is a value from 0 to 1, where 0 represents a and 1 represents b. Any value between 0 and 1 will result in a proportional amount of a and b.

This method uses the precise calculation that does not suffer precision loss from high exponential differences.

def self.max(a : CommonMatrix(T, M, N), b : CommonMatrix(U, M, N)) : CommonMatrix forall T, U, M, N #

Returns a new matrix with the maximum element from each matrix.

``Geode.max(Matrix[[1, 2], [3, 4]], Matrix[[4, 3], [2, 1]]) # => [[4, 3], [3, 4]]``

def self.max(matrix : CommonMatrix(T, M, N), value : U) : CommonMatrix forall T, U, M, N #

Returns a new matrix with the greater value of the element or value.

``Geode.max(Matrix[[1, 2], [3, 4]], 2) # => [[2, 2], [3, 4]]``

def self.max(a : CommonVector(T, N), b : CommonVector(U, N)) : CommonVector forall T, U, N #

Returns a new vector with the maximum component from each vector.

``Geode.max(Vector[1, 2, 3], Vector[3, 2, 1]) # => (3, 2, 3)``

def self.max(vector : CommonVector(T, N), value : U) : CommonVector forall T, U, N #

Returns a new vector with the greater value of the component or value.

``Geode.max(Vector[1, 2, 3], 2) # => (2, 2, 3)``

def self.min(a : CommonMatrix(T, M, N), b : CommonMatrix(U, M, N)) : CommonMatrix forall T, U, M, N #

Returns a new matrix with the minimum element from each matrix.

``Geode.min(Matrix[[1, 2], [3, 4]], Matrix[[4, 3], [2, 1]) # => [[1, 2], [2, 1 ]]``

def self.min(matrix : CommonMatrix(T, M, N), value : U) : CommonMatrix forall T, U, M, N #

Returns a new matrix with the lesser value of the element or value.

``Geode.min(Matrix[[1, 2], [3, 4]], 2) # => [[1, 2], [2, 2]]``

def self.min(a : CommonVector(T, N), b : CommonVector(U, N)) : CommonVector forall T, U, N #

Returns a new vector with the minimum component from each vector.

``Geode.min(Vector[1, 2, 3], Vector[3, 2, 1]) # => (1, 2, 1)``

def self.min(vector : CommonVector(T, N), value : U) : CommonVector forall T, U, N #

Returns a new vector with the lesser value of the component or value.

``Geode.min(Vector[1, 2, 3], 2) # => (1, 2, 2)``