Hello,
I am working with the Azure Kinect. I want to trigger events in specific (round) areas.
I have successfully built a solution where an intersection with (or being inside) a box is tracked. However, since the areas that should trigger events are round, I would need something like a “cylinder contains point” node or something similar.
I attached a picture of the areas, if that helps. If you enter the white outer circle, a sound should play. If you enter specific areas within the smaller green circle (to be more specific: I would actually need small slices of a cylinder, since being in a specific area of that circle should trigger a specific speaker), a corresponding sound should be triggered.
Is there maybe a NuGet package I could use, or can I build a collision with a cylinder (or a slice of a cylinder) in any way?
Just to mention, that normally that is done via compute shader pipeline, basically you have your point cloud as a position world, then you can use raymartching primitives like tube or cylinder, you calculate how many points are inside of primitive, since SDF gives you +/- signs, you know when point is inside of an sdf.
I guess using compute is not case for you so here is formula for tube, and position Vector3:
public static bool PointInsideTube(Vector3 positionWorld, Vector3 origin, float r1, float r2, float height)
{
// 1. Check Vertical Height (Y-Axis)
// Calculate height relative to the bottom origin
float relativeY = positionWorld.Y - origin.Y;
// Check if point is below the origin or above the total height
if (relativeY < 0 || relativeY > height)
{
return false;
}
// 2. Check XZ Plane Distance (Hollow Cylinder Cross-section)
float dx = positionWorld.X - origin.X;
float dz = positionWorld.Z - origin.Z;
// Calculate squared distance to avoid expensive square root operations
float distSq = dx * dx + dz * dz;
// Check if the squared distance is between the squared inner and outer radii
return distSq >= (r1 * r1) && distSq <= (r2 * r2);
}
I don’t know what pipeline you are currently using, but if I were solving this problem, I would use FUSE and compute shaders. But in general, if performance is not important, you can just take the points and work with them. I’m afraid I don’t know of any ready-made solutions, but consider making such a solution yourself.
I’m not sure about the proposed Raymarching primitives, because you can get by with simple operations on points in space (for example, by taking XY of points and calculating the distance from a certain point, you can designate a cylinder). You can also count the number of points that are ‘sufficiently distant’ from a certain point. All this can be done with CPU nodes without much effort, but without performance optimisation.