Physics4K  2013-06-04
Physics4K is the next great evolution in 2D physics engines. built upon the C++ Game Framework, it is going to take the next generation gaming world by storm.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
PK Namespace Reference

Classes

class  Arbiter
 
class  Box
 
class  BoxPair
 
class  Circle
 
class  Contact
 
class  Joint
 
class  Matrix22
 
class  Shape
 
class  ShapePair
 
class  Vector2f
 
class  World
 

Enumerations

enum  ShapeType { BoxType, CircleType, NoneShape }
 

Functions

PK_API int OBBOBBCollision (Box *box1, Box *box2, Contact *contacts)
 
PK_API int CircleCircleCollision (Circle *circle1, Circle *circle2, Contact *contacts)
 
PK_API int BoxCircleCollision (Box *box, Circle *circle, Contact *contacts, bool isCircleFirst)
 
Vector2f Abs (const Vector2f &value)
 
Matrix22 Abs (const Matrix22 &value)
 
float Sign (float x)
 
float Dot (const Vector2f &a, const Vector2f &b)
 
Vector2f Tangent (const Vector2f &vector)
 
float Cross (const Vector2f &v1, const Vector2f &v2)
 
float Clamp (float value, const float min, const float max)
 
unsigned int Factorial (unsigned int n)
 
unsigned int TriangleNumber (unsigned int n)
 
float FastInvSqrt (float n)
 
float FastSqrt (float n)
 
Vector2f operator* (float s, const Vector2f &v)
 
Vector2f operator/ (float s, const Vector2f &v)
 

Enumeration Type Documentation

Enumerator
BoxType 
CircleType 
NoneShape 

Function Documentation

Vector2f PK::Abs ( const Vector2f value)

ABS a Vector2f

Vector to ABS

Matrix22 PK::Abs ( const Matrix22 value)

ABS a Matrix22

Matrix22 to ABS

int PK::BoxCircleCollision ( Box box,
Circle circle,
Contact contacts,
bool  isCircleFirst 
)

Calculate the collision data between two circles

OBB Box to try and collide with... ... A circle, which is this Contacts array for us to store our contacts in For the collision resolution, the normal of the contact needs to be in the direction of the first shape in the BoxPair. This will determine which direction the normal is facing

int PK::CircleCircleCollision ( Circle circle1,
Circle circle2,
Contact contacts 
)

Calculate the collision data between two circles

Circle 1 to try and collide with... ... Circle 2, which is this Contacts array for us to store our contacts in

float PK::Clamp ( float  value,
const float  min,
const float  max 
)

Clamp a particlualr value between two numbers

Value to clamp Minimum value Maximum value

float PK::Cross ( const Vector2f v1,
const Vector2f v2 
)

Calculate the weird 2D cross product thing

Part 1 of the two vector equation Part 2 of the two vector equation

float PK::Dot ( const Vector2f vectorA,
const Vector2f vectorB 
)

Calculate the dot product of two vectors

Vector to test Another vector to test

unsigned int PK::Factorial ( unsigned int  n)

Apply the factorial (!) to a number


Number to Factorialize

float PK::FastInvSqrt ( float  n)

Fast inverse square root using Newton-Rapheson approximation. Straight Quake 3 right here Taken from: http://forums.overclockers.co.uk/showthread.php?p=8773984 and http://en.wikipedia.org/wiki/Fast_inverse_square_root


Number to rootify

float PK::FastSqrt ( float  n)

Fast square root using the fast inverse square root method


Number to rootify

int PK::OBBOBBCollision ( Box box1,
Box box2,
Contact contacts 
)

Calculate the Box to Box collision

Box 1 to check Box 1 to check Array of contacts to return

PART 1: Setup

PART 2: SEPARATING AXIS TEST

PART 3: FIND THE AXIS WITH LEAST PENETRATION

PART 4: SET UP THE CLIPPING PLANE DATA BASED UPON THE REFERENCE PLANE CALCULATE THE INCIDENT PLANE THIS IS THE BIT I'M MOST FUZZY ON. HOW DOES IT?

PART 5: CLIP THE INCIDENT PLANE AGAINST REFERENCE PLANE SIDE PLANES

Vector2f PK::operator* ( float  s,
const Vector2f v 
)
  • operator for the Vector2f, in the other direction
Parameters
Scalarto multiply
Vector2f PK::operator/ ( float  s,
const Vector2f v 
)

/ operator for the Vector2f, in the other direction

Parameters
Scalarto divide
float PK::Sign ( float  value)

Calculate just the sign of a float

Float to test

Vector2f PK::Tangent ( const Vector2f vector)

Calculate the tangent vector of a given 2D vector (rotate by 90 degrees)

Vector to rotate

unsigned int PK::TriangleNumber ( unsigned int  n)

Get the triangle number for a specific part of the sequence


Number to triangleize