Collision detection between bezier and ball.

This is a discussion on Collision detection between bezier and ball. within the Game Programming forums, part of the General Programming Boards category; OK, I got a really weird problem. I have a cubic bezier curve in 3d space and a sphere. The ...

  1. #1
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893

    Collision detection between bezier and ball.

    OK, I got a really weird problem. I have a cubic bezier curve in 3d space and a sphere. The bezier curve is static, the sphere moves. Given the curve's definition a, c1, c2, e, each of which is a 3d vector, and the ball's position and movement vector, I need to find out the closest the bezier and the ball ever get to each other.

    This is probably confusing.

    Code:
    Ball
    {
      Vector3d center;
      Vector3d movement;
    }
    
    Bezier
    {
      Vector3d start;
      Vector3d control1;
      Vector3d control2;
      Vector3d end;
    }
    Find
    1) the least distance between any point on the bezier curve and any point on the line segment (Ball.center, Ball.movement).
    2) the point on the line segment that is closest.
    3) the bezier parameter t of the point on the bezier that is closest.

    Given these three, I can achieve the other things I need to do.

    Any ideas are GREATLY appreciated! I've been sitting on this for 2 days, and it has mostly given me a headache.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    So it's not a ball then, just a line segment? If it is a ball, what is the radius?
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21