3
$\begingroup$

This has to do with collision detection between a ray and a cube. I have a camera position that I am looking from and a ray is being shot into the scene which contains a cube.

I have the ray starting position and direction in 3D space. The cube is defined by its center position coordinates along with height, width, and depth.

I am following an algorithm I found online, and a task that I have become stuck on is finding the closest and farthest points of the cube. Google searches haven't proved promising for me thus far, I would appreciate any suggestions!

  • 4
    The farthest point on the cube has to be a vertex, so that part is easy. (In general, the farthest point in any closed convex set has to be on its boundary - just check that it's true on any line segment - and all the faces and edges of the cube are also convex.)2012-02-28
  • 0
    Yes, I believe you are right. I wasn't quite sure before but this certainly makes intuitive sense.2012-02-28
  • 1
    To clarify the question, do you mean the closest and farthest points on a fixed ray? Or do you mean the closest and farthest points on *any* ray from a fixed point?2012-07-19

3 Answers 3