# Find the point on a cone that is farthest in a given direction

#### caibbor

I'm not sure what "differential" geometry is, so hopefully this is the right section.

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:

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

Related Differential Geometry News on Phys.org

#### caibbor

I think this'll work, but there has to be a simpler formula:

Do the same test as the capsule except make one end of the capsule a sphere with zero radius (a point). Then you have to test if the point is beyond the end of the cone, which would mean that it's somewhere on the spherical end of the capsule. move that back to where the cone's circular end would be, and there you have it.

but... still, I feel like there's gotta be a simpler solution

edit: It does work, but still looking for a simpler approach.

Last edited:

#### Matterwave

Gold Member
I'm having a hard time picturing what you are trying to do. Could you describe a little better what you mean by "farthest in a given direction"? Farthest from what? Perhaps you can provide a picture of what you mean?

#### caibbor

given a vector, probably a unit vector.

if, for example, I throw the vector (0,0,1) at you, and you have a cone with the point at (1,2,3) which extends 7.4 units in the direction (0.58,0.58,0.58) with the fat end having a radius of 12.7, I want you to give me a point that exists on the surface of that cone which is no closer than any other to the end of a ray pointing in the opposite direction of my vector, (0,0,-1)

it's just the farthest point on the cone on a given direction (supplied by a unit vector).

I had hoped the sphere example in my first post whould help male things clear.

edit: this is an implementation of at least one working method that I described for a cone: http://pastebin.com/6JxJj2q8

#### Matterwave

Gold Member
So, let me see if I understand you correctly. Given a cone of arbitrary position and orientation, you want to know the point on the cone farthest from some fixed point?

I would first change my coordinate system so that the base of my cone is in the x-y plane, and the center of the base is at the origin. It should be relatively easy to write down the equation of the surface of the cone in this coordinate system.

The distance from any point p to a point on the cone should be a simple function with several constraints. Given the constraints, maximize the function by using, e.g. Lagrange multipliers.

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving