module Geode
Overview
Mathematics library supporting vectors, matrices, quaternions, and more.
Defined in:
geode.crgeode/angles/angle.cr
geode/angles/comparison.cr
geode/angles/degrees.cr
geode/angles/gradians.cr
geode/angles/operations.cr
geode/angles/radians.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/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 \"/srv/crystaldoc.info/gitlab-arctic-fox-geode-v0.2.1/src\"`).stringify.chomp }}
-
Current version of the Geode library.
Class Method Summary
-
.edge(value : T, edge) forall T
Returns 0 if the value is less than the edge value or 1 if it's greater.
-
.lerp(a, b, t : Number)
Calculates the linear interpolation between two values.
-
.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.
-
.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.
-
.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.
-
.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.
-
.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.
-
.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.
-
.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.
-
.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.
Class Method Detail
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
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.
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]]
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]]
Returns a new vector with the maximum component from each vector.
Geode.max(Vector[1, 2, 3], Vector[3, 2, 1]) # => (3, 2, 3)
Returns a new vector with the greater value of the component or value.
Geode.max(Vector[1, 2, 3], 2) # => (2, 2, 3)
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 ]]
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]]
Returns a new vector with the minimum component from each vector.
Geode.min(Vector[1, 2, 3], Vector[3, 2, 1]) # => (1, 2, 1)
Returns a new vector with the lesser value of the component or value.
Geode.min(Vector[1, 2, 3], 2) # => (1, 2, 2)