Cone intersect

Hi,

I have a bit of math problem,

I have a list of points (3d) and a cone, I want to be able to count (quickly) how many of these points are ‘inside’ the cone.

Can anyone help?

Thanks

This might not be the most efficient manner, but here’s one way you could do it.

First of all determine the bounding box of the cone. Use that to weed out any points that are obviously nowhere near the cone. You could also do the same thing by using a sphere that encompasses the whole cone.

Next, you check any points that are inside the bounding box/sphere to see if they are inside the cone.

Assuming your cone is standing up straight (i.e. the tip is pointing up or down the Y-axis), one way to do this might be to determine at what “height” in the cone that point is, then determine the radius of the cone at that height. Then just determine if the point is within that radius. The cone wouldn’t necessarily have to be oriented in any certain way to do this, but if it’s tilted from any of the axes you’d have to determine the plane that intersects the cone and the point.

Actually, even with a tilted cone you might be able to find the ellipse that a horizontal plane intersecting with the cone creates, but my calculus is a bit rusty so I wouldn’t know how to determine that offhand.