thi.ng/geom Documentation

repository·feature/no-org·Indexed 21 days ago

https://github.com/thi-ng/geom

A modular geometry and visualization toolkit for Clojure and ClojureScript. It provides 2D/3D vector and matrix algebra, mesh processing (CSG, subdivision, I/O), a particle-based Verlet physics engine, spatial indexing via quadtree/octree, and rendering abstractions for SVG, WebGL, and OpenGL.

Tokens
737
Snippets
2
Records
4
Agent score
27%

What's inside thi.ng/geom

  1. Overview of thi.ng/geom capabilities

    feature/no-org

    thi.ng/geom is a modular geometry and visualization toolkit for Clojure and ClojureScript. It is designed around a functional approach to generative design, using a polymorphic, protocol-based API to transform and convert data types.

    ** Core Capabilities:

    • Geometry & Math: 2D/3D vector and matrix algebra, custom vector types with GLSL-style swizzling, and ~35+ immutable geometry types.
    • Visualization: Unified abstractions for SVG, WebGL, and OpenGL (via JOGL for desktop).
    • Mesh Processing: 3D mesh generation (lathe, polyhedra), subdivision (Catmull-Clark, etc.), CSG (Boolean) operations, and I/O (PLY, STL, OBJ, OFF).
    • Physics: 2D/3D particle-based Verlet physics engine with spring constraints and force fields.
    • Data Viz: Declarative 2D data visualization (area, bar, line, scatter, etc.) using SVG.
    • Spatial Indexing: 2D/3D quadtree/octree for fast spatial lookups.
    • Voxel Data: Experimental sparse voxel tree (SVO) with isosurface extraction.
  2. Understand the thi.ng/geom project structure

    feature/no-org

    The library is organized into several functional modules:

    • core: Fundamental geometry types, 2D/3D vector algebra, matrices, and quaternions.
    • types: High-level 2D/3D data types implementing core protocols.
    • utils: Utilities for point collections, normals, path sampling, intersection tests, and Delaunay triangulation.
    • mesh: 3D mesh tools including I/O, subdivision, repair, and CSG operations.
    • physics: Particle-based physics engine using Verlet integration.
    • svg: SVG generation using hiccup-compatible syntax, including a 3D mesh renderer.
    • viz: Declarative 2D data visualization module (currently SVG-based).
    • voxel: Experimental sparse voxel tree (SVO) and isosurface extraction.
    • gl: Unified API for OpenGL (desktop) and WebGL (browser) including shader management, buffers, and textures.
  3. Configure JOGL dependencies for OpenGL in Clojure

    feature/no-org

    If you are using the library's OpenGL functionality in a Clojure (non-ClojureScript) environment, you must include the appropriate JOGL native dependencies for your target platform.

    Example for macOS universal binaries:

    [org.jogamp.gluegen/gluegen-rt "2.3.2" :classifier "natives-macosx-universal"]
    [org.jogamp.jogl/jogl-all "2.3.2" :classifier "natives-macosx-universal"]

    Supported platform classifiers include:

    • natives-android-aarch64.jar
    • natives-android-armv6.jar
    • natives-linux-amd64.jar
    • natives-linux-armv6.jar
    • natives-linux-armv6hf.jar
    • natives-linux-i586.jar
    • natives-macosx-universal.jar
    • natives-solaris-amd64.jar
    • natives-solaris-i586.jar
    • natives-windows-amd64.jar
    • natives-windows-i586.jar