Quark Physics  1.0
2D Rigid and Soft Body Physics Engine
QCollision Class Reference

The QCollision class performs all collision detection operations. The relevant methods return contact data from the collision tests. More...

#include <qcollision.h>

Collaboration diagram for QCollision:

Classes

struct  Contact
 Contains all the contact information required to resolve collisions. More...
 
struct  Project
 

Static Public Member Functions

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)
 

Static Public Attributes

static QObjectPool< QCollision::ContactcontactPool
 

Detailed Description

The QCollision class performs all collision detection operations. The relevant methods return contact data from the collision tests.

Member Function Documentation

◆ CircleAndCircle()

void QCollision::CircleAndCircle ( vector< QParticle * > &  particlesA,
vector< QParticle * > &  particlesB,
QAABB  boundingBoxB,
vector< QCollision::Contact * > &  contacts,
float  specifiedRadius = 0.0f 
)
static

Checks collisions between circle(s) and circle(s).

Parameters
particlesAA collection of particles representing one or more circles, each having a radius.
particlesBAnother collection of particles representing one or more circles, each having a radius.
contactsA collection where collision contact information will be stored.

◆ CircleAndPolygon()

void QCollision::CircleAndPolygon ( vector< QParticle * > &  circleParticles,
vector< QParticle * > &  polygonParticles,
vector< QCollision::Contact * > &  contacts 
)
static

Checks collisions between circle(s) and polygon.

Parameters
particlesAA collection of particles representing one or more circles, each having a radius.
particlesBA collection of particles that make up a polygon.
contactsA 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
circleParticlesA collection of particles representing one or more circles, each having a radius.
polylineParticlesA collection of particles that make up a polyline.
polylineAABBAABB of polyline for tests between circle and AABB.
contactsA collection where collision contact information will be stored.
circlesArePolygonIt defines whether circle particles is the part of a polygon.

◆ LineIntersectionLine()

QVector QCollision::LineIntersectionLine ( QVector  d1A,
QVector  d1B,
QVector  d2A,
QVector  d2B 
)
static

Checks intersection between lines.

Parameters
d1AThe point A of the d1 line.
d1BThe point B of the d1 line.
d2AThe point A of the d2 line.
d2BThe 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
pointA point to check.
polygonA 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
pointA point to check.
polygonA 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
pointA point to check.
polygonA collection of particles that make up a polygon.
Returns
Returns true if the point is inside the polygon, false otherwise.

◆ PolygonAndPolygon()

void QCollision::PolygonAndPolygon ( vector< QParticle * > &  particlesA,
vector< QParticle * > &  particlesB,
vector< QCollision::Contact * > &  contacts 
)
static

Checks collisions between polygons.

Parameters
particlesAA collection of particles that make up a polygon.
particlesBAnother collection of particles that make up a polygon.
contactsA collection where collision contact information will be stored.

◆ PolylineAndPolygon()

void QCollision::PolylineAndPolygon ( vector< QParticle * > &  polylineParticles,
vector< QParticle * > &  polygonParticles,
vector< QCollision::Contact * > &  contacts 
)
static

Checks collisions between polyline and polygon.

Parameters
polylineParticlesA collection of particles that make up a polyline.
polygonParticlesAnother collection of particles that make up a polygon.
contactsA 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: