The QCollision class performs all collision detection operations. The relevant methods return contact data from the collision tests.
More...
#include <qcollision.h>
|
struct | Contact |
| Contains all the contact information required to resolve collisions. More...
|
|
struct | Project |
|
|
static QObjectPool< QCollision::Contact > & | GetContactPool () |
|
static void | PolygonAndPolygon (vector< QParticle * > &particlesA, vector< QParticle * > &particlesB, vector< QCollision::Contact * > &contacts) |
|
static void | CircleAndPolygon (vector< QParticle * > &circleParticles, vector< QParticle * > &polygonParticles, vector< QCollision::Contact * > &contacts) |
|
static void | CircleAndCircle (vector< QParticle * > &particlesA, vector< QParticle * > &particlesB, QAABB boundingBoxB, vector< QCollision::Contact * > &contacts, float specifiedRadius=0.0f) |
|
static void | PolylineAndPolygon (vector< QParticle * > &polylineParticles, vector< QParticle * > &polygonParticles, vector< QCollision::Contact * > &contacts) |
|
static void | CircleAndPolyline (vector< QParticle * > &circleParticles, vector< QParticle * > &polylineParticles, QAABB polylineAABB, vector< QCollision::Contact * > &contacts, bool circlesArePolygon=false) |
|
static QVector | LineIntersectionLine (QVector d1A, QVector d1B, QVector d2A, QVector d2B) |
|
static bool | PointInPolygon (QVector &point, vector< QParticle * > &polygon) |
|
static bool | PointInPolygon (QVector &point, vector< QVector > &polygon) |
|
static bool | PointInPolygon2 (QVector point, vector< QParticle * > &polygon) |
|
The QCollision class performs all collision detection operations. The relevant methods return contact data from the collision tests.
◆ CircleAndCircle()
Checks collisions between circle(s) and circle(s).
- Parameters
-
particlesA | A collection of particles representing one or more circles, each having a radius. |
particlesB | Another collection of particles representing one or more circles, each having a radius. |
contacts | A collection where collision contact information will be stored. |
◆ CircleAndPolygon()
Checks collisions between circle(s) and polygon.
- Parameters
-
particlesA | A collection of particles representing one or more circles, each having a radius. |
particlesB | A collection of particles that make up a polygon. |
contacts | A collection where collision contact information will be stored. |
◆ CircleAndPolyline()
void QCollision::CircleAndPolyline |
( |
vector< QParticle * > & |
circleParticles, |
|
|
vector< QParticle * > & |
polylineParticles, |
|
|
QAABB |
polylineAABB, |
|
|
vector< QCollision::Contact * > & |
contacts, |
|
|
bool |
circlesArePolygon = false |
|
) |
| |
|
static |
Checks collisions between circles and polyline.
- Parameters
-
circleParticles | A collection of particles representing one or more circles, each having a radius. |
polylineParticles | A collection of particles that make up a polyline. |
polylineAABB | AABB of polyline for tests between circle and AABB. |
contacts | A collection where collision contact information will be stored. |
circlesArePolygon | It defines whether circle particles is the part of a polygon.
|
◆ LineIntersectionLine()
Checks intersection between lines.
- Parameters
-
d1A | The point A of the d1 line. |
d1B | The point B of the d1 line. |
d2A | The point A of the d2 line. |
d2B | The point B of the d2 line. |
- Returns
- An intersection position. If the intersection doesn't exist, returns QVector::NaN.
◆ PointInPolygon() [1/2]
bool QCollision::PointInPolygon |
( |
QVector & |
point, |
|
|
vector< QParticle * > & |
polygon |
|
) |
| |
|
static |
Checks whether a specified point is inside the specified polygon.
- Parameters
-
point | A point to check. |
polygon | A collection of particles that make up a polygon. |
- Returns
- Returns true if the point is inside the polygon, false otherwise.
◆ PointInPolygon() [2/2]
bool QCollision::PointInPolygon |
( |
QVector & |
point, |
|
|
vector< QVector > & |
polygon |
|
) |
| |
|
static |
Checks whether a specified point is inside the specified polygon.
- Parameters
-
point | A point to check. |
polygon | A collection of vectors that make up a polygon. |
- Returns
- Returns true if the point is inside the polygon, false otherwise.
◆ PointInPolygon2()
bool QCollision::PointInPolygon2 |
( |
QVector |
point, |
|
|
vector< QParticle * > & |
polygon |
|
) |
| |
|
static |
Checks whether a specified point is inside the specified particle polygon.
- Parameters
-
point | A point to check. |
polygon | A collection of particles that make up a polygon. |
- Returns
- Returns true if the point is inside the polygon, false otherwise.
◆ PolygonAndPolygon()
Checks collisions between polygons.
- Parameters
-
particlesA | A collection of particles that make up a polygon. |
particlesB | Another collection of particles that make up a polygon. |
contacts | A collection where collision contact information will be stored. |
◆ PolylineAndPolygon()
Checks collisions between polyline and polygon.
- Parameters
-
polylineParticles | A collection of particles that make up a polyline. |
polygonParticles | Another collection of particles that make up a polygon. |
contacts | A collection where collision contact information will be stored. |
- Note
- To check collisions between two polylines, call this method twice with the polylines swapped as arguments.
-
"Polyline" is commonly used to define polygons for softbody objects. In contrast to a solid and filled polygon , you can think of a polyline as a polygon shape formed by a connected and knotted rope. If a polygon-shaped rope is deformed, it may not always remain a polygon, it can overlap and its corners can merge. Collision testing for a polyline is performed based on these assumptions
The documentation for this class was generated from the following files: