le3d - LightEngine 3D
A straightforward C++ 3D software engine for real-time graphics
Namespaces | Enumerations | Functions
collisions.h File Reference

LightEngine 3D (tools): Collision routines. More...

#include "../engine/le3d.h"

Go to the source code of this file.

Namespaces

 LeCollisions
 

Enumerations

enum  LeCollisions::COLLISIONS_RECT_RESULT {
  LeCollisions::COLLISIONS_RECT_NO_COL = 0x00, LeCollisions::COLLISIONS_RECT_LEFT_COL = 0x01, LeCollisions::COLLISIONS_RECT_RIGHT_COL = 0x02, LeCollisions::COLLISIONS_RECT_TOP_COL = 0x03,
  LeCollisions::COLLISIONS_RECT_BOTTOM_COL = 0x04
}
 Return values of the collideRectRect routine. More...
 
enum  LeCollisions::COLLISIONS_SPHERE_RESULT { LeCollisions::COLLISIONS_SPHERE_NO_COL = 0x00, LeCollisions::COLLISIONS_SPHERE_SURFACE = 0x01 }
 Return values of the collideSphereSphere routine. More...
 
enum  LeCollisions::COLLISIONS_BOX_RESULT { LeCollisions::COLLISIONS_BOX_NO_COL = 0x00, LeCollisions::COLLISIONS_BOX_SIDE = 0x01, LeCollisions::COLLISIONS_BOX_EDGE = 0x02, LeCollisions::COLLISIONS_BOX_CORNER = 0x03 }
 Return values of the collideSphereBox routine. More...
 
enum  LeCollisions::COLLISIONS_MESH_RESULT { LeCollisions::COLLISIONS_MESH_NO_COL = 0x00, LeCollisions::COLLISIONS_MESH_SIDE = 0x01, LeCollisions::COLLISIONS_MESH_EDGE = 0x02 }
 Return values of the collideSphereMesh routine. More...
 
enum  LeCollisions::COLLISIONS_BOX_TRACE_RESULT {
  LeCollisions::COLLISIONS_BOX_TRACE_NO_INTER = 0x00, LeCollisions::COLLISIONS_BOX_TRACE_LEFT = 0x01, LeCollisions::COLLISIONS_BOX_TRACE_RIGHT = 0x02, LeCollisions::COLLISIONS_BOX_TRACE_BOTTOM = 0x03,
  LeCollisions::COLLISIONS_BOX_TRACE_TOP = 0x04, LeCollisions::COLLISIONS_BOX_TRACE_BACK = 0x05, LeCollisions::COLLISIONS_BOX_TRACE_FRONT = 0x06
}
 Return values of the traceBox routine. More...
 

Functions

int LeCollisions::collideRectRect (float &ansX, float &ansY, float srcX, float srcY, float srcW, float srcH, float dstX, float dstY, float dstW, float dstH)
 Compute the intersection between two rectangles. More...
 
int LeCollisions::collideSphereSphere (LeVertex &ans, LeVertex &contact, const LeVertex &pos, float srcRadius, float dstRadius)
 Compute the intersection between two spheres. More...
 
int LeCollisions::collideSphereBox (LeVertex &ans, LeVertex &contact, const LeVertex &pos, float srcRadius, const LeVertex &dstSize)
 Compute the intersection between a sphere and a box. More...
 
int LeCollisions::collideSphereMesh (LeVertex &ans, LeVertex &contact, const LeVertex &pos, float srcRadius, const LeMesh *dstMesh)
 Compute the intersection between a sphere and a mesh. More...
 
int LeCollisions::traceSphere (const LeVertex &pos, float radius, const LeVertex &axis, float &distance)
 
int LeCollisions::traceBox (const LeVertex &pos, const LeVertex &size, const LeVertex &axis, float &distance)
 Compute the intersection between a casted ray and a box. More...
 
int LeCollisions::traceMesh (const LeMesh *mesh, const LeAxis &axis, float &distance)
 Compute the intersection between a casted ray and a mesh. More...
 

Detailed Description

LightEngine 3D (tools): Collision routines.

All platforms implementation

Author
Frederic Meslin (fred@.nosp@m.fred.nosp@m.slab..nosp@m.net) http://fredslab.net
Version
1.75

The MIT License (MIT) Copyright (c) 2015-2018 Frédéric Meslin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.