- 19

- 0

I need to find the point on a cone that is farthest in a given direction.

This can be done easily if the shape were a sphere which is represented as a point and a radius:

farthest_point = sphere_origin + normalized_dir * sphere_radius;

A capsule is also simple, which is represented as two spheres which expresses the bounds. You just do the same sphere equation above for both spheres, dot the results with the direction, and take which ever value gave the largest absolute value. (in the event that a line is perpendicular with the capsule's broad side, the point will be around the spheres but that's okay since every other point is at the same distance. Gotta pick one, and that's as good as any.)

Now what I'm faced with is now is a cone, which can be represented as a point, a direction, a length, and a radius. Not sure what to do with this one. I can get the radius of the cone at an arbitrary point up the length of the cone, but I don't know if it helps:

radius_at_dist = ( dist / length ) * radius

edit: not that it should help find a solution, but this is for the Support() function of a GJK collision detection algorithm.