Rand Stats




This is an embryo of a NativeCall port of the kazmath library, which is a low-level library for manipulation of graphics primitives. It's similar to others graphics libraries such as OpenGL, but it's simpler and, in some cases, faster.


You need to install kazmath from source (URL above), compiling it. Follow the instructions to create a shared library.

Then you xan install this from this source or via

zef install kazmath


Since only some functions have been ported, basically you can rotate a vector , like this:

    my mat4 $one-mat .= new;
    my mat4 $turn-pi = kmMat4RotationY($one-mat, pi/2);
    say $turn-pi;
    my vec4 $out .= new;
    my vec4 $in  .= new(1.Num, 0.Num, 0.Num, 1.Num);
    my vec4 $result = kmVec4Transform( $out, $in, $turn-pi);
    say $result;

See also

Tutorial for NativeCall

Also, this has been built mainly to be used as a recipe in the upcoming Raku Recipes book by APress. Check out all Raku titles in Apress such as this one.

If you want to create a Dockerfile with kazmath, check out also the download -and-compile-kazmath.sh included in this repo, which can be useful to create the image.


(c) JJ Merelo jj@raku.org, 2021-2022

This module is licensed under the Artistic 2.0 License (the same as Raku itself )