Repository navigation
Visualization System Interaction Model
The Interaction Model defines how 2D mouse movements on the screen (clicks, hovers) are translated into actions within the 3D data structures, like selecting a tensor or highlighting an operation.
Translating a mouse click into a 3D coordinate is mathematically complex (Raycasting). Doing it efficiently ensures the UI feels responsive even when hovering over a point cloud with millions of vertices.
TokenPrint heavily utilizes Three.js Raycasting.
In the Architecture Explorer, the user hovers over a single THREE.Points mesh.
- The mouse coordinates are projected via a Raycaster into the 3D scene.
- The Raycaster intersects with the point cloud buffer.
- It returns the
indexof the intersected vertex. - Because the point cloud array is mapped 1:1 with the
TensorInfoarray, TokenPrint instantly retrieves the tensor metadata (name, shape, params) associated with that index. - This metadata is dispatched to the Zustand store, triggering the Right Panel to update.
To ensure that raycasting against massive geometry remains performant at 60fps, TokenPrint relies on optimized intersection libraries (like three-mesh-bvh if necessary) to quickly discard non-intersecting geometry.
flowchart TD
Mouse[Mouse Move X,Y] --> Ray[Raycaster Project]
Ray --> Intersect[Intersect THREE.Points]
Intersect --> Index[Vertex Index: 4520]
Index --> Lookup[Lookup TensorList[4520]]
Lookup --> Store[Zustand: setHoveredTensor()]
Store --> UI[Update Tooltip UI]
| Previous | Home | Next |
|---|---|---|
| Camera System | Home | Architecture |
TokenPrint Wiki | Home | Getting Started | User Guide | Concepts | Architecture | API | GitHub
TokenPrint is an interactive 3D visualization platform for exploring transformer architectures, tensors, and real-time LLM inference.
- User Guide
- Architecture Explorer
- Live Inference
- Tensor Inspector
- Camera Controls
- HUD
- Timeline
- Scene Navigation
- Transformer Concepts
- Tokenization
- Embeddings
- Positional Encoding
- RoPE
- Multi-Head Attention
- KV Cache
- LayerNorm
- Feed Forward Network
- Residual Connections
- Logits
- Softmax
- Sampling
- Autoregressive Generation
- Visualization System
- Scene Graph
- Geometry
- Materials
- Animation System
- Color Mapping
- Camera System
- Interaction Model
- Architecture
- Overall Architecture
- Frontend
- Backend
- WebSocket Protocol
- Data Pipeline
- Renderer
- Event System