Calculations
CALC.tox
Layer: spatial logic
In: 2 POPs (point or shape)
Out: 1 CHOP
CALC measures how two spatial entities relate to each other: two points, a point and a shape, or two shapes. It reduces that relation to one control signal. Four measurements are available: centre-to-centre distance, signed distance to a surface, an inside/outside test, and a smooth fade between two concentric spheres. Together these are enough for most body-to-object interactions in the lab, such as proximity, entering a zone, and gradual transitions. They come from a single component with one predictable output.
Role in the setup
CALC turns geometry into control data. A typical setup has a tracked joint from Azure Kinect sensors on input 1 and a Virtual objects on input 2. The resulting CHOP drives any parameter: the opacity of a projected layer, the gain of a sound, the state of a scene.
Technical specification
Let A be input 1 and B be input 2.
- Distance between points. The Euclidean distance between the centres of A and B:
center_dist = ‖c_A − c_B‖(metres). - Distance between shapes. The distance from A to the surface of B, or between the surfaces of A and B. The result is signed: positive outside, negative inside. This works for every closed shape. For boxes and cylinders, the distance is measured outward from the shape's centre, so values near edges and corners are slightly larger than the true Euclidean surface distance.
- In or outside of a shape. A binary containment test:
inside = 1if A is inside B, otherwise0. - Fade to sphere. A continuous value between the inner sphere (radius r_in) and the outer shell (radius r_out) of a sphere-type virtual object. It is
1inside r_in,0beyond r_out, and changes smoothly in between. This makes a soft, non-binary interaction zone. It requires B to be a sphere with Outer shell turned on. - One calculation at a time. Only one calculation can be on. The others are greyed out. This keeps the output unambiguous and keeps the GPU/CPU cost per instance predictable. For several measurements, use several CALC instances in parallel.
- POP inputs. Both inputs are POPs, so the calculations work directly on the GPU-side geometry from Virtual objects. A single tracked joint counts as a one-point POP.
Parameters
| Parameter | Function |
|---|---|
| Distance between points | distance between the centres of both inputs |
| Distance between shapes | signed distance to the surface of the shape(s) |
| In or outside of a shape | containment test: is input 1 inside input 2 |
| Fade to sphere | smooth value between inner sphere and outer shell |
Outputs
| Channel | Unit / range | Meaning |
|---|---|---|
center_dist | metres, ≥ 0 | distance between the centres |
shell_dist | metres; negative = inside | signed distance to the surface |
inside | 0 / 1 | containment |
fade | 0 … 1 | 1 inside the inner sphere, 0 outside the outer shell |
Limitations and expected behaviour
- Fade to sphere greyed out: input 2 is not a sphere with Outer shell on.
- Wrong distances: the shape is not closed (it has an open side).
- Box or cylinder distances slightly too large near edges and corners: this comes from measuring outward from the centre (see above).
- Yellow warning inside the component when a point is on input 1: harmless.
- Raw tracking noise passes straight through. For stable triggers, smooth the joint input, or add hysteresis to the
insideoutput.
History
Since the October 2026 revision, CALC replaces four earlier components: DIST_between_points, DIST_to_object, IN_or_OUT_object and FADE_to_sphere. Distance to a shape now works for any closed shape and between two shapes.
Relations
- ← Azure Kinect sensors (input 1)
- ← Virtual objects (input 2, or both inputs)
- → any parameter, e.g. in Ambisonics sound control, Wall projection or Floor projection content
References
- User README: CALC-README
- Repository: <https://github.com/SpatialComputingL/Td-updates>
- Overview: Lab Tools