Description
kotlin-math is a set of Kotlin APIs that make graphics math easier to write. The APIs are modelled after GLSL, the OpenGL Shading Language, so shader code can be ported to and from Kotlin with less change. The library's types are meant to be value types, and most operations are top-level functions rather than methods. It provides scalar types such as Half, a half-precision floating point value, and Rational, a number expressed as the ratio of two integers. Vector types come with two, three or four components for floats, halves and booleans. There are also 3x3 and 4x4 float matrices, a Quaternion for representing orientation, and a Ray made of an origin and a direction. Vector components can be read by name, as an array, or with the traditional 1-based mathematical indexing. Each vector type also offers property aliases and a more limited form of swizzling than GLSL. The README says the library supports several platforms, thanks to a contribution from another developer. Maven coordinates are given for adding it to a project, and the README shows how to build the jar yourself. The source is public on GitHub.…
Highlights
- GLSL-style vector, matrix and quaternion types
- Top-level functions instead of methods
- Half-precision and boolean vector types
- Component aliases and swizzling
- Maven install and a single build command
Ratings & Reviews
No ratings yet
Be the first to rate Kotlin Math.
People also visit

MathParser.org-mXparser
Math Parser: Java, C#, C++, Kotlin, Android, and all .NET platforms
Kotlin Math FAQ
What is kotlin-math?
A Kotlin library of graphics math APIs, modelled after GLSL, that makes vector and matrix code easier to write.
Who is it for?
Kotlin developers writing graphics, game or shader-related code who want maths that reads like GLSL.
What types does it include?
Float, half and boolean vectors with two to four components, 3x3 and 4x4 float matrices, quaternions and rays, plus Half and Rational scalars.
Are the types mutable?
The README says the types are meant to be value types, and most APIs are exposed as top-level functions.
How do I add it?
Use the Maven coordinates in the README, or build the jar from source with the command the README gives.
What are the best Kotlin Math alternatives?
Popular alternatives to Kotlin Math include Cglm, RTM and KaTeX. See all Kotlin Math alternatives





