WIP
- Adjacency matrix (undirected graph)
- Cons list (with & without reference counting)
- Hashset (generic)
- Hashtable (generic)
- Object wrapper
- Octree
- Quadtree
- Spatial grid (1D, 2D, 3D)
- Memory pool (auto-growth, manual compacts)
- Reference counting utils
- Murmur Hash (32bit version)
- Poisson disc sampling
- Verlet physics (particles)
- Vec2/3/4 (w/ opt SSE impls)
- Vector swizzling
- Line clipping
…
TBD
- Premake5
- GNU Make
- GCC / Clang (w/ C11 support)
- fswatch (only needed for
./autotest
runner) - emscripten & node (only needed for asm.js x-compilation via
./compile
) - cscope (only needed for
./browse
) - rsvg & ffmpeg (only needed for
./makevideo
)
The library itself has no 3rd party dependencies. Some of the examples however use these additional libs:
- stb_image (bundled under
/examples/common
)
Get further help for autogenerated Makefile
:
# generate Makefiles
premake5 gmake
make help
# Usage: make [config=name] [target]
#
# CONFIGURATIONS:
# debug_sse
# debug_no_sse
# release_sse
# release_no_sse
#
# TARGETS:
# all (default)
# clean
# test
# lib
# ex-poisson
# ex-dla
# build & run tests manually
make config=debug_sse test && bin/debug/test
# or
make config=release_sse test && bin/release/test
# ...or use auto test w/ file watcher
# tests re-run automatically if files in /src or /test are changed
./autotest
make config=debug_sse lib
# or
make config=release_sse lib
brew install cscope
./browse
# display disassembly (OSX)
otool -jtV bin/release/libcthing.a | less
# display global symbols defined in lib
nm -g -j bin/release/libcthing.a | grep --color=never _ct_
# build library & example app
make config=release_sse ex-poisson
# show usage
bin/release/ex-poisson
# Missing input file
# Usage: ex-poisson [options] image [ > out.svg ]
# -b HEX bg color (default: ffffff)
# -f HEX fg color (default: 0000ff)
# -g FLOAT gamma (default: 3.00)
# -i invert (also swaps fg/bg) (default: no)
# -m FLOAT min distance (default: 2.00)
# -x FLOAT max distance (default: 10.00)
# -r FLOAT dot radius (default: 1.00)
# -q INT quality (default: 100)
# concrete example (for image size roughly 700x1000px)
bin/release/ex-poisson -g 1.25 -q 500 -m 1.5 -x 16 assets/iris.jpg > assets/iris.svg
# build library & example app
make config=release_sse ex-dla && bin/release/ex-dla > assets/dla.svg
# build library & example app
make config=release_sse ex-verlet && bin/release/ex-verlet
# ouputs are stored as SVG sequence in /assets
# use script below to convert to mp4 (requires rsvg & ffmpeg) -> out.mp4
./makevideo verlet
# help / usage
./compile -h
# compile with tests, closure pass & remove duplicate fns
./compile -tdc
python3 -m http.server
# in browser dev console - http://localhost:8000/
# geom(); geom._main()
The following defines
can be used to customize behavior:
CT_FEATURE_LOG | enable logging (if NDEBUG is defined, the debug log level is disabled) |
CT_FEATURE_ANSI | use ANSI colors in log messages |
CT_FEATURE_CHECKS | enable runtime assertions (via CT_CHECK macro) |
CT_FEATURE_CHECK_MEM | enable runtime memory checks (via CT_CHECK_MEM macro) |
CT_FEATURE_SSE | enable SSE version |
Name | Role | Website |
Karsten Schmidt | initiator & principal developer | thi.ng |
This project is open source and licensed under the Apache Software License 2.0.