Skip to content

cppd/math

Repository files navigation

Math Viewer

Just for fun with mathematics and stuff

image

Contents

File types

  • OBJ and STL files with objects in 3-space
  • Extended OBJ and STL files with objects in n-space
  • Text files with the coordinates of points in n-space

Rendering

GPU

  • Triangle meshes (rasterization)
  • Volumes (ray marching)
  • Isosurfaces (ray marching)
  • Shadows (ray tracing, ray marching, shadow mapping)
  • Order-independent transparency (lists of fragments)

CPU

  • Bidirectional path tracing with multiple importance sampling
  • (n-1)-simplex meshes in n-space on (n-1)-dimensional screen
  • n-dimensional microfacet BRDF
  • Spectral rendering

Algorithms

2-space

C++ and GLSL

Subject Algorithms
Discrete Fourier transform for arbitrary sizes Bluestein's algorithm and radix-2 fast Fourier transform
Optical flow Pyramidal Lucas-Kanade
Convex hull Divide et impera

Spaces with arbitrary number of dimensions

C++

Subject Algorithms
Convex hull Randomized incremental
Delaunay triangulation Convex hull of paraboloid
Voronoi diagram The Delaunay triangulation
Manifold reconstruction Cocone
Manifold reconstruction with boundary detection BoundCocone
Euclidean minimum spanning tree Kruskal’s algorithm and the Delaunay triangulation
Intersection of hyperplanes Gaussian elimination
Intersection of convex polytopes The simplex algorithm
Ray intersection acceleration using spatial subdivision 2d-trees
Ray intersection acceleration using object subdivision Bounding volume hierarchies and the surface area heuristic
Eigenvalues and eigenvectors of symmetric matrices Jacobi method
Least squares fitting a plane to points Principal component analysis

Technical details

Property Value
Programming languages C++23, GLSL 4.60
C++ compilers GCC 13, Clang 18
Platforms Linux
Graphics and compute APIs Vulkan 1.3 with ray tracing extensions
Frameworks Qt 6
Libraries FreeType, GMP
Optional libraries cuFFT (for DFT tests), FFTW (for DFT tests)
Build systems CMake

Images

3-manifold reconstruction and path tracing in 4-space

2D images of a 3D image of the 3-manifold reconstructed from the points on the 3-torus T3 (S1×S1×S1)

  • 5-space
    • The convex hull
    • 4-simplex facets
  • 4-space
    • 3-simplex mesh without boundary
    • 4-parallelotope hierarchy
    • 4-dimensional microfacet BRDF
    • 3-ball light source
    • 4-dimensional soft shadows
    • Parallel projection onto 3D screen

Volumetric rendering

image image image image image image image image image image image image image image image

4D Cornell box

2D images of a 3D image of the 4-dimensional Cornell box

  • Seven 3-parallelotopes (the sides of the box)
  • One 3-parallelotope light source
  • One 3-simplex mesh without boundary (3-sphere)
  • One 4-parallelotope
  • 4-dimensional microfacet BRDF
  • 4-dimensional soft shadows
  • Perspective projection onto 3D screen

image image image image

Real-time rendering

Semitransparent objects

  • Triangle mesh (green) and its ray tracing shadows
  • Isosurface (blue) and its ray marching shadows

image image image image

3D models

Spectral rendering

  1. Blackbody 2500 K
  2. Daylight 4000 K
  3. Daylight D65
  4. Blackbody 12000 K

image image image image

image image image image

4D polytope

4-dimensional cross-polytope

v -11   0   0   0
v   0 -12   0   0
v   0   0 -13   0
v   0   0   0 -14
v   0   0   0  15
v   0   0  16   0
v   0  17   0   0
v  18   0   0   0
f 1 2 3 4
f 1 2 3 5
f 1 2 6 4
f 1 2 6 5
f 1 7 3 4
f 1 7 3 5
f 1 7 6 4
f 1 7 6 5
f 8 2 3 4
f 8 2 3 5
f 8 2 6 4
f 8 2 6 5
f 8 7 3 4
f 8 7 3 5
f 8 7 6 4
f 8 7 6 5

image image image image