Commits

Anonymous committed 91cc95d

Added doc notes to the collision functions

  • Participants
  • Parent commits 66e2c3a
  • Branches physics

Comments (0)

Files changed (2)

src/pgCollision.c

 //TODO: add rest contact
 
 
-// Apply Liang-Barskey clip on a AABB box
-// (p1, p2) is the input line segment to be clipped (note: it's a 2d vector)
-// (ans_p1, ans_p2) is the output line segment
-//TEST: Liang-Barskey clip has been tested.
+/**
+ * Apply Liang-Barskey clip on a AABB box
+ * (p1, p2) is the input line segment to be clipped (note: it's a 2d vector)
+ * (ans_p1, ans_p2) is the output line segment
+ * TEST: Liang-Barskey clip has been tested.
+ *
+ * @param p
+ * @param q
+ * @param u1
+ * @param u2
+ * @return
+ */
 static int _LiangBarskey_Internal(double p, double q, double* u1, double* u2)
 {
     double val;
     return 1; 
 }
 
+/**
+ * TODO
+ *
+ * @param joint
+ * @param step
+ */
 static void _UpdateV(PyJointObject* joint, double step)
 {
     PyContact *contact;
     }
 }
 
+/**
+ * TODO
+ *
+ * @param joint
+ * @param step
+ */
 static void _UpdateP(PyJointObject* joint, double step)
 {
     //isolated function
 }
 
-
 int Collision_LiangBarskey(AABBBox* box, PyVector2* p1, PyVector2* p2, 
     PyVector2* ans_p1, PyVector2* ans_p2)
 {
 
 void Collision_ApplyContact(PyObject* contactObject, double step)
 {
+/**
+ * TODO
+ */
 #define MAX_C_DEP 0.01
+
+/**
+ * TODO
+ */
 #define BIAS_FACTOR 0.2
 
     PyVector2 neg_dV, refV, incidV;
 
     contact->resist = sqrt(refBody->fRestitution*incidBody->fRestitution);
 
+    /*
+     * TODO: explain the magic happening here.
+     */
+
     refR = c_diff(contact->pos, refBody->vecPosition);
     incidR = c_diff(contact->pos, incidBody->vecPosition);
     //dV = v2 + w2xr2 - (v1 + w1xr1)
     0                           /* tp_del */
 };
 
-
+/**
+ * Deallocates the passed PyContact.
+ *
+ * @param contact The PyContact to deallocate
+ */
 static void _ContactDestroy(PyJointObject* contact)
 {
     PyVector2 **p = ((PyContact*)contact)->ppAccMoment;
     }
 }
 
+/**
+ * Creates a new PyContact object.
+ */
 static PyObject* _ContactNewInternal(PyTypeObject *type, PyObject *args,
     PyObject *kwds)
 {
     return (PyObject*)op;
 }
 
+/**
+ * Creates a new PyContact object and initializes its internals.
+ *
+ * @param refBody
+ * @param incidBody
+ * @return A new PyContact.
+ */
 static PyJointObject* _ContactNew(PyBodyObject* refBody,PyBodyObject* incidBody)
 {
     PyContact* contact;
     return (PyJointObject*)contact;
 }
 
+/* Internally used PyContact functions */
+
 PyObject* PyContact_New(PyBodyObject* refBody, PyBodyObject* incidBody)
 {
     return (PyObject*)_ContactNew (refBody, incidBody);

src/pgHelpFunctions.c

 #include <assert.h>
 #include "pgHelpFunctions.h"
 
-
 int
 DoubleFromObj (PyObject* obj, double* val)
 {
 	assert(low<high);
 	t = x<high?x:high;
 	return t>low?t:low;
-}
+}