Added more collision subs

This commit is contained in:
Dander7BD 2013-12-16 10:31:26 +01:00
parent d8b323e230
commit 4858f573e6
6 changed files with 98 additions and 18 deletions

View File

@ -251,6 +251,7 @@ namespace Oyster { namespace Collision3D { namespace Utility
bool Intersect( const Point &pointA, const Point &pointB, ::Oyster::Math::Float3& worldPointOfContact )
{
//! @todo TODO: implement Stub
return false;
}
@ -286,6 +287,7 @@ namespace Oyster { namespace Collision3D { namespace Utility
bool Intersect( const Ray &ray, const Point &point, ::Oyster::Math::Float &connectDistance, ::Oyster::Math::Float3& worldPointOfContact )
{
//! @todo TODO: implement Stub
return false;
}
@ -338,11 +340,13 @@ namespace Oyster { namespace Collision3D { namespace Utility
bool Intersect( const Sphere &sphere, const Point &point, ::Oyster::Math::Float3& worldPointOfContact )
{
//! @todo TODO: implement Stub
return false;
}
bool Intersect( const Sphere &sphere, const Ray &ray, ::Oyster::Math::Float &connectDistance, ::Oyster::Math::Float3& worldPointOfContact )
{
//! @todo TODO: implement Stub
return false;
}
@ -411,21 +415,25 @@ namespace Oyster { namespace Collision3D { namespace Utility
bool Intersect( const Plane &plane, const Point &point, const ::Oyster::Math::Float3& worldPointOfContact )
{
//! @todo TODO: implement Stub
return false;
}
bool Intersect( const Plane &plane, const Ray &ray, ::Oyster::Math::Float &connectDistance, const ::Oyster::Math::Float3& worldPointOfContact )
{
//! @todo TODO: implement Stub
return false;
}
bool Intersect( const Plane &plane, const Sphere &sphere, const ::Oyster::Math::Float3& worldPointOfContact )
{
//! @todo TODO: implement Stub
return false;
}
bool Intersect( const Plane &planeA, const Plane &planeB, const ::Oyster::Math::Float3& worldPointOfContact )
{
//! @todo TODO: implement Stub
return false;
}
@ -440,6 +448,16 @@ namespace Oyster { namespace Collision3D { namespace Utility
return true;
}
bool Intersect( const BoxAxisAligned &box, const Point &point, Float3 &worldPointOfContact )
{ // by Dan Andersson
if( Intersect(box, point) )
{
worldPointOfContact = point.center;
return true;
}
return false;
}
bool Intersect( const BoxAxisAligned &box, const Ray &ray, Float &connectDistance )
{ // by Dan Andersson
Float tMin = ::std::numeric_limits<Float>::max(),
@ -456,6 +474,16 @@ namespace Oyster { namespace Collision3D { namespace Utility
return true;
}
bool Intersect( const BoxAxisAligned &box, const Ray &ray, Float &connectDistance, Float3 &worldPointOfContact )
{ // by Dan Andersson
if( Intersect(box, ray, connectDistance) )
{
worldPointOfContact = ray.origin + ray.direction * connectDistance;
return true;
}
return false;
}
bool Intersect( const BoxAxisAligned &box, const Sphere &sphere )
{ // by Dan Andersson
Float4 e = Max( Float4(box.minVertex - sphere.center, 0.0f), Float4::null );
@ -465,6 +493,12 @@ namespace Oyster { namespace Collision3D { namespace Utility
return true;
}
bool Intersect( const BoxAxisAligned &box, const Sphere &sphere, Float3 &worldPointOfContact )
{
//! @todo TODO: implement stub
return Intersect( box, sphere );
}
bool Intersect( const BoxAxisAligned &box, const Plane &plane )
{ // by Dan Andersson
Float e, d;
@ -474,6 +508,12 @@ namespace Oyster { namespace Collision3D { namespace Utility
return true;
}
bool Intersect( const BoxAxisAligned &box, const Plane &plane, Float3 &worldPointOfContact )
{
//! @todo TODO: implement stub
return Intersect( box, plane );
}
// bool Intersect( const BoxAxisAligned &box, const Triangle &triangle )
// { return false; /* TODO: */ }
@ -507,6 +547,16 @@ namespace Oyster { namespace Collision3D { namespace Utility
return true;
}
bool Intersect( const Box &box, const Point &point, Float3 &worldPointOfContact )
{ // by Dan Andersson
if( Intersect(box, point) )
{
worldPointOfContact = point.center;
return true;
}
return false;
}
bool Intersect( const Box &box, const Ray &ray, Float &connectDistance )
{ // by Dan Andersson
Float tMin = ::std::numeric_limits<Float>::max(),
@ -522,6 +572,16 @@ namespace Oyster { namespace Collision3D { namespace Utility
return true;
}
bool Intersect( const Box &box, const Ray &ray, Float &connectDistance, Float3 &worldPointOfContact )
{ // by Dan Andersson
if( Intersect(box, ray, connectDistance) )
{
worldPointOfContact = ray.origin + ray.direction * connectDistance;
return true;
}
return false;
}
bool Intersect( const Box &box, const Sphere &sphere )
{ // by Dan Andersson
// center: sphere's center in the box's view space
@ -534,6 +594,12 @@ namespace Oyster { namespace Collision3D { namespace Utility
return true;
}
bool Intersect( const Box &box, const Sphere &sphere, Float3 &worldPointOfContact )
{
//! @todo TODO: implement stub
return Intersect( box, sphere );
}
bool Intersect( const Box &box, const Plane &plane )
{// by Dan Andersson
Float e, d;
@ -543,6 +609,12 @@ namespace Oyster { namespace Collision3D { namespace Utility
return true;
}
bool Intersect( const Box &box, const Plane &plane, Float3 &worldPointOfContact )
{
//! @todo TODO: implement stub
return Intersect( box, plane );
}
bool Intersect( const Box &boxA, const BoxAxisAligned &boxB )
{ // by Dan Andersson
Float3 alignedOffsetBoundaries = (boxB.maxVertex - boxB.minVertex) * 0.5f,

View File

@ -55,16 +55,24 @@ namespace Oyster { namespace Collision3D { namespace Utility
// bool Intersect( const Triangle &triangleA, const Triangle &triangleB, ? );
bool Intersect( const BoxAxisAligned &box, const Point &point );
bool Intersect( const BoxAxisAligned &box, const Point &point, ::Oyster::Math::Float3 &worldPointOfContact );
bool Intersect( const BoxAxisAligned &box, const Ray &ray, ::Oyster::Math::Float &connectDistance );
bool Intersect( const BoxAxisAligned &box, const Ray &ray, ::Oyster::Math::Float &connectDistance, ::Oyster::Math::Float3 &worldPointOfContact );
bool Intersect( const BoxAxisAligned &box, const Sphere &sphere );
bool Intersect( const BoxAxisAligned &box, const Sphere &sphere, ::Oyster::Math::Float3 &worldPointOfContact );
bool Intersect( const BoxAxisAligned &box, const Plane &plane );
bool Intersect( const BoxAxisAligned &box, const Plane &plane, ::Oyster::Math::Float3 &worldPointOfContact );
// bool Intersect( const BoxAxisAligned &box, const Triangle &triangle );
bool Intersect( const BoxAxisAligned &boxA, const BoxAxisAligned &boxB );
bool Intersect( const Box &box, const Point &point );
bool Intersect( const Box &box, const Point &point, ::Oyster::Math::Float3 &worldPointOfContact );
bool Intersect( const Box &box, const Ray &ray, ::Oyster::Math::Float &connectDistance );
bool Intersect( const Box &box, const Ray &ray, ::Oyster::Math::Float &connectDistance, ::Oyster::Math::Float3 &worldPointOfContact );
bool Intersect( const Box &box, const Sphere &sphere );
bool Intersect( const Box &box, const Sphere &sphere, ::Oyster::Math::Float3 &worldPointOfContact );
bool Intersect( const Box &box, const Plane &plane );
bool Intersect( const Box &box, const Plane &plane, ::Oyster::Math::Float3 &worldPointOfContact );
// bool Intersect( const Box &box, const Triangle &triangle, ? );
bool Intersect( const Box &boxA, const BoxAxisAligned &boxB );
bool Intersect( const Box &boxA, const Box &boxB );

View File

@ -60,8 +60,8 @@ bool Plane::Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worl
case Type_sphere: return Utility::Intersect( *this, *(Sphere*)&target, worldPointOfContact );
case Type_plane: return Utility::Intersect( *(Plane*)&target, *this, worldPointOfContact );
// case Type_triangle: return false; // TODO:
case Type_box_axis_aligned: return false; // return Utility::Intersect( *(BoxAxisAligned*)&target, *this, worldPointOfContact );
case Type_box: return false; // return Utility::Intersect( *(Box*)&target, *this, worldPointOfContact );
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this, worldPointOfContact );
case Type_box: return Utility::Intersect( *(Box*)&target, *this, worldPointOfContact );
case Type_frustrum: return false; // TODO:
default: worldPointOfContact = NULL;
return false;

View File

@ -58,8 +58,8 @@ bool Point::Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worl
case Type_sphere: return Utility::Intersect( *(Sphere*)&target, *this, worldPointOfContact );
//case Type_plane: return Utility::Intersect( *(Plane*)&target, *this, worldPointOfContact );
// case Type_triangle: return false; // TODO:
case Type_box_axis_aligned: return false; // return Utility::Intersect( *(BoxAxisAligned*)&target, *this, worldPointOfContact );
case Type_box: return false; // return Utility::Intersect( *(Box*)&target, *this, worldPointOfContact );
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this, worldPointOfContact );
case Type_box: return Utility::Intersect( *(Box*)&target, *this, worldPointOfContact );
case Type_frustrum: return false; // TODO:
default: worldPointOfContact = NULL;
return false;

View File

@ -67,8 +67,8 @@ bool Ray::Intersects( const ICollideable &target, ::Oyster::Math::Float3 &worldP
case Type_sphere: return Utility::Intersect( *(Sphere*)&target, *this, this->collisionDistance, worldPointOfContact );
case Type_plane: return Utility::Intersect( *(Plane*)&target, *this, this->collisionDistance, worldPointOfContact );
// case Type_triangle: return false; // TODO:
case Type_box_axis_aligned: return false; // return Utility::Intersect( *(BoxAxisAligned*)&target, *this, this->collisionDistance, worldPointOfContact );
case Type_box: return false; // return Utility::Intersect( *(Box*)&target, *this, this->collisionDistance, worldPointOfContact );
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this, this->collisionDistance, worldPointOfContact );
case Type_box: return Utility::Intersect( *(Box*)&target, *this, this->collisionDistance, worldPointOfContact );
case Type_frustrum: return false; // TODO:
default: worldPointOfContact = NULL;
return false;

View File

@ -55,8 +55,8 @@ bool Sphere::Intersects( const ICollideable &target, ::Oyster::Math::Float3 &wor
case Type_sphere: return Utility::Intersect( *this, *(Sphere*)&target, worldPointOfContact );
//case Type_plane: return Utility::Intersect( *(Plane*)&target, *this, worldPointOfContact );
// case Type_triangle: return false; // TODO:
case Type_box_axis_aligned: return false; // return Utility::Intersect( *(BoxAxisAligned*)&target, *this, worldPointOfContact );
case Type_box: return false; // return Utility::Intersect( *(Box*)&target, *this, worldPointOfContact );
case Type_box_axis_aligned: return Utility::Intersect( *(BoxAxisAligned*)&target, *this, worldPointOfContact );
case Type_box: return Utility::Intersect( *(Box*)&target, *this, worldPointOfContact );
case Type_frustrum: return false; // TODO:
default: worldPointOfContact = Float3::null;
return false;