Added stub functions
More funcitonallity for intersect functions.
This commit is contained in:
parent
de0078265c
commit
283633c6c6
|
@ -249,6 +249,11 @@ namespace Oyster { namespace Collision3D { namespace Utility
|
|||
return true; // Passed all tests, is in same position
|
||||
}
|
||||
|
||||
bool Intersect( const Point &pointA, const Point &pointB, const ::Oyster::Math::Float3& worldPointOfContact )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Ray &ray, const Point &point, Float &connectDistance )
|
||||
{ // by Dan Andersson
|
||||
Float connectOffsetSquared;
|
||||
|
@ -279,6 +284,16 @@ namespace Oyster { namespace Collision3D { namespace Utility
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Ray &ray, const Point &point, ::Oyster::Math::Float &connectDistance, const ::Oyster::Math::Float3& worldPointOfContact )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Ray &rayA, const Ray &rayB, ::Oyster::Math::Float &connectDistanceA, ::Oyster::Math::Float &connectDistanceB, const ::Oyster::Math::Float3& worldPointOfContact )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Sphere &sphere, const Point &point )
|
||||
{ // by Dan Andersson
|
||||
Float3 dP = point.center - sphere.center;
|
||||
|
@ -321,6 +336,24 @@ namespace Oyster { namespace Collision3D { namespace Utility
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Sphere &sphere, const Point &point, const ::Oyster::Math::Float3& worldPointOfContact )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Sphere &sphere, const Ray &ray, ::Oyster::Math::Float &connectDistance, const ::Oyster::Math::Float3& worldPointOfContact )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Sphere &sphereA, const Sphere &sphereB, const ::Oyster::Math::Float3& worldPointOfContact )
|
||||
{
|
||||
Ray sphereRay(sphereA, Float3(sphereB.center-sphereA.center).Normalize());
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Plane &plane, const Point &point )
|
||||
{ // by Dan Andersson
|
||||
Float connectOffset;
|
||||
|
@ -364,6 +397,26 @@ namespace Oyster { namespace Collision3D { namespace Utility
|
|||
return true; // none parallell planes ALWAYS intersects somewhere
|
||||
}
|
||||
|
||||
bool Intersect( const Plane &plane, const Point &point, const ::Oyster::Math::Float3& worldPointOfContact )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Plane &plane, const Ray &ray, ::Oyster::Math::Float &connectDistance, const ::Oyster::Math::Float3& worldPointOfContact )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Plane &plane, const Sphere &sphere, const ::Oyster::Math::Float3& worldPointOfContact )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const Plane &planeA, const Plane &planeB, const ::Oyster::Math::Float3& worldPointOfContact )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Intersect( const BoxAxisAligned &box, const Point &point )
|
||||
{ // by Dan Andersson
|
||||
if( point.center.x < box.minVertex.x ) return false;
|
||||
|
|
|
@ -25,18 +25,28 @@ namespace Oyster { namespace Collision3D { namespace Utility
|
|||
void Compare( ::Oyster::Math::Float &connectOffset, const Plane &plane, const Point &point );
|
||||
|
||||
bool Intersect( const Point &pointA, const Point &pointB );
|
||||
bool Intersect( const Point &pointA, const Point &pointB, const ::Oyster::Math::Float3& worldPointOfContact );
|
||||
|
||||
bool Intersect( const Ray &ray, const Point &point, ::Oyster::Math::Float &connectDistance );
|
||||
bool Intersect( const Ray &rayA, const Ray &rayB, ::Oyster::Math::Float &connectDistanceA, ::Oyster::Math::Float &connectDistanceB );
|
||||
bool Intersect( const Ray &ray, const Point &point, ::Oyster::Math::Float &connectDistance, const ::Oyster::Math::Float3& worldPointOfContact );
|
||||
bool Intersect( const Ray &rayA, const Ray &rayB, ::Oyster::Math::Float &connectDistanceA, ::Oyster::Math::Float &connectDistanceB, const ::Oyster::Math::Float3& worldPointOfContact );
|
||||
|
||||
bool Intersect( const Sphere &sphere, const Point &point );
|
||||
bool Intersect( const Sphere &sphere, const Ray &ray, ::Oyster::Math::Float &connectDistance );
|
||||
bool Intersect( const Sphere &sphereA, const Sphere &sphereB );
|
||||
bool Intersect( const Sphere &sphere, const Point &point, const ::Oyster::Math::Float3& worldPointOfContact );
|
||||
bool Intersect( const Sphere &sphere, const Ray &ray, ::Oyster::Math::Float &connectDistance, const ::Oyster::Math::Float3& worldPointOfContact );
|
||||
bool Intersect( const Sphere &sphereA, const Sphere &sphereB, const ::Oyster::Math::Float3& worldPointOfContact );
|
||||
|
||||
bool Intersect( const Plane &plane, const Point &point );
|
||||
bool Intersect( const Plane &plane, const Ray &ray, ::Oyster::Math::Float &connectDistance );
|
||||
bool Intersect( const Plane &plane, const Sphere &sphere );
|
||||
bool Intersect( const Plane &planeA, const Plane &planeB );
|
||||
bool Intersect( const Plane &plane, const Point &point, const ::Oyster::Math::Float3& worldPointOfContact );
|
||||
bool Intersect( const Plane &plane, const Ray &ray, ::Oyster::Math::Float &connectDistance, const ::Oyster::Math::Float3& worldPointOfContact );
|
||||
bool Intersect( const Plane &plane, const Sphere &sphere, const ::Oyster::Math::Float3& worldPointOfContact );
|
||||
bool Intersect( const Plane &planeA, const Plane &planeB, const ::Oyster::Math::Float3& worldPointOfContact );
|
||||
|
||||
// bool Intersect( const Triangle &triangle, const Point &point, ? );
|
||||
// bool Intersect( const Triangle &triangle, const Ray &ray, ? );
|
||||
|
|
|
@ -50,6 +50,24 @@ bool Plane::Intersects( const ICollideable &target ) const
|
|||
}
|
||||
}
|
||||
|
||||
bool Plane::Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const
|
||||
{
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe: return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target, worldPointOfContact );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance, worldPointOfContact );
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
bool Plane::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target.type )
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace Oyster { namespace Collision3D
|
|||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
|
|
@ -48,6 +48,24 @@ bool Point::Intersects( const ICollideable &target ) const
|
|||
}
|
||||
}
|
||||
|
||||
bool Point::Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const
|
||||
{
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe: return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target, worldPointOfContact );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance, worldPointOfContact );
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
bool Point::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target.type )
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace Oyster { namespace Collision3D
|
|||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
|
|
@ -55,6 +55,26 @@ bool Ray::Intersects( const ICollideable &target ) const
|
|||
}
|
||||
}
|
||||
|
||||
bool Ray::Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const
|
||||
{
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe:
|
||||
this->collisionDistance = 0.0f;
|
||||
return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target, worldPointOfContact );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance, worldPointOfContact );
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
bool Ray::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target.type )
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace Oyster { namespace Collision3D
|
|||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
|
|
@ -45,6 +45,24 @@ bool Sphere::Intersects( const ICollideable &target ) const
|
|||
}
|
||||
}
|
||||
|
||||
bool Sphere::Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const
|
||||
{
|
||||
switch( target.type )
|
||||
{
|
||||
case Type_universe: return true;
|
||||
case Type_point: return Utility::Intersect( *this, *(Point*)&target, worldPointOfContact );
|
||||
case Type_ray: return Utility::Intersect( *this, *(Ray*)&target, ((Ray*)&target)->collisionDistance, worldPointOfContact );
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
bool Sphere::Contains( const ICollideable &target ) const
|
||||
{
|
||||
switch( target.type )
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace Oyster { namespace Collision3D
|
|||
|
||||
virtual ::Utility::DynamicMemory::UniquePointer<ICollideable> Clone( ) const;
|
||||
bool Intersects( const ICollideable &target ) const;
|
||||
bool Intersects( const ICollideable &target, const ::Oyster::Math::Float3 &worldPointOfContact ) const;
|
||||
bool Contains( const ICollideable &target ) const;
|
||||
};
|
||||
} }
|
||||
|
|
Loading…
Reference in New Issue