Skip to main content
Arctic Dev

Geode

Geode is an mathematics library for Crystal. It provides a variety of types such as vectors, matrices, and spatial primitives. It aims to be expressive and performant. Geode is a suitable replacement for glm in Crystal. Its data structures are compatible with GLSL.

Here’s a snippet of code using Geode:

vec = Vector2[3, 4]        # => (3, 4)
vec.length                 # => 5
vec.rotate(90.degrees)     # => (-4, 3)
vec.angle.to_degrees.round # => 53.0°

mat = Matrix2F.scale(5).reflect_x # => [[-5.0, 0.0], [0.0, 5.0]]
vec * mat                         # => (-15.0, 20.0)