TanGA Documentation¶
TanGA is a Python and C++ library for interactive technical visualization and geometric algebra (Clifford algebra) — two independent toolkits under one roof.
- Visualization — build animated, interactive 3D and 2D technical scenes in the browser, and export them as standalone HTML (animations included), glTF/GLB, PNG, or MP4. No knowledge of geometric algebra required.
- Geometric algebra / Clifford algebra — sparse multivectors over vector spaces of up to 31 dimensions with arbitrary signature, with explicit support for Euclidean, projective, and conformal spaces (E2/E3, P2/P3, N2/N3, PGA2/PGA3). Backed by a C++ template core with a zero-setup Python interface (pytanga).
Key Features¶
Visualization¶
-
Interactive 3D & 2D scenes —
pytanga.vizprovides a live WebSocket‑driven Three.js visualizer in the browser. Add entities, style them, rotate/pan/zoom the camera, and work in 3D or 2D (space_dim=2). Usable without geometric algebra. → 3D Visualization -
Animations — Frame-by-frame streaming at ~60 FPS and keyframe tweening (
animate_to) with a scene-awareTimelinesequencer. → Animation -
Standalone HTML export — Export self-contained, shareable HTML that supports animations:
- standalone HTML (self‑contained, shareable, supports animations),
- embeddable HTML for iframes (e.g. Reveal.js slides, supports animations),
- glTF / GLB for use in other 3D tools,
- PNG screenshots and MP4 video (requires a local browser).
→ Export
- Interactivity — Interactive controls (sliders, dropdowns, buttons),
pointer-based object interaction (click, drag, scroll), and a simplified
ActPointAPI. Jupyter notebook support with inline iframes. → Controls · Object Interaction · Jupyter Notebooks
Geometric Algebra / Clifford Algebra¶
-
High-dimensional algebras — Work with geometric algebras over vector spaces of up to 31 dimensions with any signature. Sparse blade encoding keeps storage and computation proportional to the number of non-zero coefficients, not the full \(2^D\) blade space. → Dynamic multivectors
-
Built-in spaces — Explicit, ready-to-use algebras for Euclidean (E2/E3), projective (P2/P3), and conformal (N2/N3, PGA2/PGA3) spaces. → Basis Classes
-
C++ template header library — The core engine is 100 % C++17 headers with
constexpr-friendly templates. Fixing dimension and signature at compile time lets the compiler inline and constant-fold blade arithmetic down to a handful of machine instructions. → C++ documentation -
On‑demand Python compilation — pytanga generates, compiles, and caches pybind11 bindings on first use of an
Algebra(dim, sig, dtype). Every unique combination is compiled once and loaded in milliseconds thereafter. Pre‑compiled wheels for the most common configurations ship with the package, so zero‑setuppip installworks for most users. → Environment & Setup · Compile & Binding -
GA formula solving — Convert GA product equations (\(A \circ X = Y\)) into linear systems, solve with Gaussian elimination (floating‑point or modular), and reconstruct the unknown multivector. This operates at C++ level with blade‑mask‑restricted matrices. → Matrix mapping & equations (C++) · Equation Solving (Python)
-
Matrix and tensor pipelines — Every blade‑mask‑aware operation is available as a matrix (
MVMatrix,MVProductMatrix) or a labelled tensor (MVTensor,MVLabeledTensor). Label‑driven Einsum‑style contractions, broadcasts, and slicing work directly on multivector data. → Matrix Operations · Tensor Operations -
Geometry analysis and creation —
analyze()extracts the geometric meaning from a multivector (point, line, plane, rotor, motor, …) andcreate()constructs a multivector from geometric primitives. Works across E3, P3, N3, and PGA3 algebras with a unified, algebra‑independent data model. → Geometry (Python) -
galgebra interoperability —
GalgebraBridgeprovides bidirectional conversion between galgebra (sympy‑based, symbolic) and tanga (numeric) multivectors. Derive symbolically, compute numerically, visualize — or work the other way. Handles both orthogonal and non‑orthogonal bases via automatic metric diagonalization. → Galgebra Bridge
Documentation Sections¶
| Section | Audience | Contents |
|---|---|---|
| C++ Documentation | C++ users | Public C++ API: multivectors, products, matrix equations, congruence maps |
| Python Documentation | Python users | pytanga: algebra basics, basis classes, blade masks, matrix/solver/tensor pipelines, geometry, visualization, galgebra interop |
| Developer Documentation | Contributors | Architecture overview, type system, GA pipeline internals, coding style guides, build workflows |
AI-Tool Documentation Access¶
When pytanga is installed as a dependency, the markdown documentation and example scripts are packaged inside the wheel. AI coding tools can expose them by calling:
import pytanga
pytanga.install_docs() # copies docs to .dep-docs/pytanga/
pytanga.install_examples() # copies examples to .dep-examples/pytanga/
pytanga.install_info() # installs docs and examples in one call
In a source checkout the functions copy from the local docs/ and
py/examples/ directories respectively. See the
Python docs for details.
License¶
TanGA is released under the Apache License 2.0.
Every source file carries an SPDX-License-Identifier: Apache-2.0 comment.