AETHER Engine
Analysis of the vector and relational calculation engine. Aether manages spatial complexity through computational geometry algorithms and constrained optimization.
Spatial Intelligence Engine
The geometric heart of Aether operates in a virtual Cartesian space where the fundamental unit of measurement is the centimeter (cm). The system manages the transformation between the real world and the screen representation through a dynamic calibration pipeline.
Transforms raster floor plan metadata into a metric environment. Calculates the cmPerPixel coefficient by analyzing the Euclidean vector between two user-defined points.
Performs a spatial stress-test on every object. The function samples 5 critical points (vertices + center) and verifies their presence within the roomPaths polygon set, ensuring no element "exits" the event perimeter.
Collision Logic (SAT Implementation)
To handle arbitrary table rotation, Aether implements the Separating Axis Theorem (SAT). Instead of simple Bounding Boxes (AABB), the engine projects entity vertices onto normal axes to detect millimetric overlaps.
// Projection and collision detection algorithm function polygonsCollide(pts1, pts2, minGap) { const axes = getNormalAxes(pts1).concat(getNormalAxes(pts2)); for (let axis of axes) { const p1 = project(pts1, axis); const p2 = project(pts2, axis); if (!overlap(p1, p2, minGap)) return false; } return true; }
Critical Collision Parameters:
| Constant | Value | Description |
|---|---|---|
TABLE_MIN_GAP | 100cm | Minimum space between table edges |
WALL_CLEARANCE | 50cm | Safety buffer for waiter passage |
SEAT_RAD | 30cm | Calculated footprint radius for each seat |
Table Entity Schema
The Table entity is not a simple graphic asset, but a complex container of physical properties and occupancy states.
{
name: string, // Unique ID (e.g., "Table 12")
x, y: float, // World-Space coordinates in cm
config: {
shape: enum, // round | rect | semi | main_table
w_cm: int, // Width/Diameter
h_cm: int, // Depth
rotation: float, // Rotation angle in degrees
optimize55: bool // Reduced seating pitch (55cm vs 60cm)
},
guests: Array<Guest> // Slots mapped based on shape
}
Guest Entity Schema
Each guest is treated as an atomic relational entity defined by attraction (Link) and repulsion (Avoid) constraints.
{
uid: string, // Global unique identifier
n, ln: string, // First and Last Name
colorTag: hex, // Social group belonging
linkedGroupId: string, // UID for forced proximity (📎)
avoidGuestUids: array, // UIDs for social repulsion (⛔)
confirmStatus: enum, // confirmed | pending | declined
ageRange: string, // child | teen | adult | senior
menuType: string, // standard | vegan | glutenfree...
cateringNote: text // Allergies and intolerances (PDF Alert)
}
Heuristic Optimization (The 🪄 Logic)
Seat assignment is a combinatorial optimization problem. Aether uses a "Greedy with Rebalancing" heuristic based on a Scoring Matrix. Each chair receives a dynamic score reflecting the guest's affinity with the surrounding context.
| Relational Factor | Score (Bias) | Algorithmic Logic |
|---|---|---|
| Link Partner | +125,000 | Forces absolute proximity (Euclidean distance < 95cm). |
| VIP Hierarchy | +800,000 | Priority anchoring to main_table types. |
| Avoid Rule (⛔) | -9,000 | Polygonal repulsion for UIDs present in avoidGuestUids. |
| Color Affinity | +500 | Encourages grouping by colorTag (e.g., teams, families). |
| Age Balancing | +165 | Consistency bias across age groups (children with children). |
Rendering Pipeline & Methods
The rendering pipeline is built on a high-frequency loop using requestAnimationFrame. Drawing is purely procedural (vector), ensuring sharpness at any zoom level.
The main drawing method. Implements local rotation logic (ctx.rotate) and dynamically calculates guest name curvature along the table perimeter.
Draws area boundaries supporting quadratic Bézier curves. Manages radial gradient fills to provide depth to the space.
Rendering of vector micro-elements. Draws the VIP icon above the occupied seat, using local coordinates relative to the table center.
Camera Projection System
Aether utilizes a virtual camera model to separate data space (World) from pixel space (Screen).
// Screen -> World conversion (Crucial for Drag & Drop) function screenToWorld(clientX, clientY) { return { x: (clientX - camera.x) / camera.zoom, y: (clientY - camera.y) / camera.zoom }; }
Camera Properties:
- Zoom Range: 0.1x to 5.0x (Sub-millimetric precision).
- Panning: Implemented via matrix translation of the Canvas origin.
- Layering: The engine draws in order (FloorPlan → Grid → Areas → Objects → Overlays) to correctly manage transparency.