0
\$\begingroup\$

The formulas to calculate the intersection between a ray and a capped cone / cone frustum are already widely known (see http://lousodrome.net/blog/light/2017/01/03/intersection-of-a-ray-and-a-cone/ or How do I test for intersection between a ray and a cone?) However, I have to test for the intersection between a ray and part of a capped cone. That means instead of having a surface doing a full revolution, it's just one quarter of it, for example.

The aforementioned formulas can handle a capped cone, but they are not suitable to determine the "revolution intersection angle". What would be the best way to solve this problem?

My idea is to first take the standard formula to intersect with the full cone and then use the parametric representation of the cone (see https://de.wikipedia.org/wiki/Kegel_(Geometrie)#Analytische_Beschreibung parametric representation is only on the German page), solve a linear equation system and then applying the inverse trigonometric functions to get the t parameter... I'm also thinking about some inequality tricks or applying the tangent function, but had no luck so far...

\$\endgroup\$
  • \$\begingroup\$ Do you mean like this? imgur.com/bfvptZ8.png \$\endgroup\$ – Jay Mar 8 at 0:16
  • \$\begingroup\$ @Jay Yes exactly. Just that the 90° angle is arbitrary and I'm just interested in the intersection with the lateral surface (basically no volume but just the lateral surface) \$\endgroup\$ – java4ever Mar 8 at 0:19
0
\$\begingroup\$

I would solve this by using the following steps:
1. Determine the points of ray-cone intersection
2. Filter out the points that are in range of a segment

You already have the first part, so using that get a list of candidate points. For each point, calculate the vector from the axis of the cone to the point (call this D).

You should also have two vectors that represent the segment. These should be vectors in the plane described by the axis of the cone, and rotated at angles representing the part to collide with. Call these A and B.

Using the solution here https://stackoverflow.com/questions/13640931/how-to-determine-if-a-vector-is-between-two-other-vectors, you can use:

if (AxD * AxB >= 0 && BxD * BxA >= 0)
// D is between A and B

where x represents the cross product.

\$\endgroup\$
  • \$\begingroup\$ Thanks very much for your idea, with some transformation magic for arbitary cones, this works (almost) perfect... However, this solution breaks down when the revolution angle of the cone is >180°... Currently looking for a solution \$\endgroup\$ – java4ever Mar 9 at 23:26
  • \$\begingroup\$ I figured out a solution for this... if the revolution angle is > 180°, just invert the "isBetween" result \$\endgroup\$ – java4ever Mar 9 at 23:46
  • \$\begingroup\$ Nice work. Glad you solved it. \$\endgroup\$ – Jay Mar 10 at 0:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.