Thursday, June 23, 2005

Spheres, Cubes and Collisions

Assumption:
The drill bit is spherical. All vectors from the origin with the length of the radius will fall along the edge of the sphere.

Process:
This also works in the opposite direction. A vector SampleVector from a point outside of the sphere to the origin will cross the border of the sphere. If the radius of the sphere is subtracted from the vector SampleVector, this will return the distance from the initial position to the border of the sphere. This distance to the edge of the sphere will provide collision detection.

Using this we can calculate the distance from the center point of a cube to the edge of the sphere. The vector from the centerpoint of the cube to the centerpoint of the sphere is created. The vector is then shortened by the length of the radius. The position is checked to see if it lies within the coordinates of the cube. If it is then a collision occurs.

Note: The cube is a set dimension. It would make more sense to use a Marching Cubes type algorithm, but this should be seen as an improvement to the system. The project will remove the voxel, that is not draw the voxel, when the edge of the sphere reaches the center of the cube.

0 Comments:

Post a Comment

<< Home


Counters