User Tools

Site Tools


example-programs

Example Programs

This page contains a little catalog of programs designed to demonstrate PolyHok's core features and syntax through practical implementations.

Select any program below to dive into its dedicated guide, complete with source code and detailed implementation explanations!


Dot Product

This program computes the dot product of two float arrays by composing a map2 skeleton (which takes two arrays as input) and a reduce skeleton.

Illustrative image of the dot product program


Julia Set

This program generates fractal images based on the Julia set. The resulting image is represented as an array of integers. The program iterates every pixel of the image using a map skeleton and the Julia function to detect if that point belongs to the Julia set or not.

Image of Julia set output


Raytracer

This program uses the raytracing technique to render a scene with various spheres. Similar to the Julia set example, this program is implemented as a map of a device function that computes every pixel of the resulting image.

Raytracer output image


Ray Marching (advanced)

This advanced program renders a real-time 3D scene using the ray marching technique. The scene is rendered by a PolyHok kernel running in parallel on the GPU, while Elixir processes handle the rendering loop and displaying the resulting frames in a window using SDL2.

 Ray Marching Demo

example-programs.txt · Last modified: by henrique.grdr