Geometric and Mathematical Extension Library : a library that is created to aid in various programming tasks
GAME Library
The GAME stands for Geometric and Mathematical Extension Library and is a library that is created to
aid in various programming tasks. These tasks are mostly related to geometry, statistics and general
algorithms. It is by no means an official library, rather a library I created for usage in my own projects.
What does GAME offer?
GAME currently contains the following APIs:
- Geometry Utilities (Vectors, Shapes, Convex Hulls, etc.)
- Geometric Extensions (Bézier Splines, Triangulation, Voronoi Tesselation, etc.)
- Graph Utilities (Graph Traversal Algorithms, MST (Kruskal), etc.)
- Matrix Utilities (2D & 3D Matrices, Matrix Operations, etc.)
- Noise Utilities (Perlin/Simplex types, Multi-layer (Octaved) Noise, Noise Variations (Billowed, Ridged), etc.)
- Statistics Utilities (PDF Sampling, Various Distributions, etc.)
- Logic Utilities (Various extension functions for logical decisions)
- Tree Utilities (Tree Traversal Algorithms, Various Trees such as Binary Trees)
- Maths Utilities (Normalization, Clipping, Faster Sqrt/Pow/Abs, etc.)
Besides these APIs, GAME also offers a variety of new and useful datastructures to store various data:
- Divide Trees – Encoding for graph vertices and edges (commonly used in the field of Orometry)
- Spatial Types – Represents an object that is locatable in a space based on coordinates
- Ranges – Easily definable ranges with exclusive/inclusive properties
- Tuples (Pair, Triple, Quartet, Quintet) – Typical data storage types
Important notes
GAME was created with my usage in mind. This (for the moment) only includes 2D implementations of most algorithms.
For example: only 2D bounding boxes and convex hull algorithms are available.
Splines
Here is an example of how you can create a Kochanek-Bartels Curve using GAME. The links
below are videos that show the impact of the tension, bias and continuity parameters.
More information can be found here.
// Create a random value for tension
val tension = Random.nextFloat()
// Define some Kochanek-Bartels Vectors.
// These are regular 2D or 3D vectors with tension, bias and continuity parameters
val p0 = KBVector(Vec2f(25.0f, 55.0f), tension, 0.0f, 0.0f)
val p1 = KBVector(Vec2f(295.0f, 125.0f), tension, 0.0f, 0.0f)
val p2 = KBVector(Vec2f(278.0f, 250.0f), tension, 0.0f, 0.0f)
val p3 = KBVector(Vec2f(150.0f, 325.0f), tension, 0.0f, 0.0f)
val p4 = KBVector(Vec2f(30.0f, 210.0f), tension, 0.0f, 0.0f)
// Create two individual curves. Each KB-Curve needs 4 points.
val c1 = KochanekBartelsCurve2f(p0, p1, p2, p3)
val c2 = KochanekBartelsCurve2f(p1, p2, p3, p4)
// Create a spline from the curves
// To evaluate the spline, use the eval function with t ∈ [0, 1]
val spline = KochanekBartelsSpline(arrayOf(c1, c2))
Made with ❤️ in Leuven.