* Q gives the position of the point of impact and W gives the
* velocity of the object being impacted.
*/
-static float sol_bounce(struct s_ball *up,
+static float sol_bounce(s_ball *up,
const float q[3],
const float w[3], float dt)
{
static float sol_test_vert(float dt,
float T[3],
- const struct s_ball *up,
- const struct s_vert *vp,
+ const s_ball *up,
+ const s_vert *vp,
const float o[3],
const float w[3])
{
static float sol_test_edge(float dt,
float T[3],
- const struct s_ball *up,
- const struct s_file *fp,
- const struct s_edge *ep,
+ const s_ball *up,
+ const s_file *fp,
+ const s_edge *ep,
const float o[3],
const float w[3])
{
static float sol_test_side(float dt,
float T[3],
- const struct s_ball *up,
- const struct s_file *fp,
- const struct s_lump *lp,
- const struct s_side *sp,
+ const s_ball *up,
+ const s_file *fp,
+ const s_lump *lp,
+ const s_side *sp,
const float o[3],
const float w[3])
{
if (t < dt)
for (i = 0; i < lp->sc; i++)
{
- const struct s_side *sq = fp->sv + fp->iv[lp->s0 + i];
+ const s_side *sq = fp->sv + fp->iv[lp->s0 + i];
if (sp != sq &&
v_dot(T, sq->n) -
/*---------------------------------------------------------------------------*/
static int sol_test_fore(float dt,
- const struct s_ball *up,
- const struct s_side *sp,
+ const s_ball *up,
+ const s_side *sp,
const float o[3],
const float w[3])
{
}
static int sol_test_back(float dt,
- const struct s_ball *up,
- const struct s_side *sp,
+ const s_ball *up,
+ const s_side *sp,
const float o[3],
const float w[3])
{
static float sol_test_lump(float dt,
float T[3],
- const struct s_ball *up,
- const struct s_file *fp,
- const struct s_lump *lp,
+ const s_ball *up,
+ const s_file *fp,
+ const s_lump *lp,
const float o[3],
const float w[3])
{
if (up->r > 0.0f)
for (i = 0; i < lp->vc; i++)
{
- const struct s_vert *vp = fp->vv + fp->iv[lp->v0 + i];
+ const s_vert *vp = fp->vv + fp->iv[lp->v0 + i];
if ((u = sol_test_vert(t, U, up, vp, o, w)) < t)
{
if (up->r > 0.0f)
for (i = 0; i < lp->ec; i++)
{
- const struct s_edge *ep = fp->ev + fp->iv[lp->e0 + i];
+ const s_edge *ep = fp->ev + fp->iv[lp->e0 + i];
if ((u = sol_test_edge(t, U, up, fp, ep, o, w)) < t)
{
for (i = 0; i < lp->sc; i++)
{
- const struct s_side *sp = fp->sv + fp->iv[lp->s0 + i];
+ const s_side *sp = fp->sv + fp->iv[lp->s0 + i];
if ((u = sol_test_side(t, U, up, fp, lp, sp, o, w)) < t)
{
static float sol_test_node(float dt,
float T[3],
- const struct s_ball *up,
- const struct s_file *fp,
- const struct s_node *np,
+ const s_ball *up,
+ const s_file *fp,
+ const s_node *np,
const float o[3],
const float w[3])
{
for (i = 0; i < np->lc; i++)
{
- const struct s_lump *lp = fp->lv + np->l0 + i;
+ const s_lump *lp = fp->lv + np->l0 + i;
if ((u = sol_test_lump(t, U, up, fp, lp, o, w)) < t)
{
if (np->ni >= 0 && sol_test_fore(t, up, fp->sv + np->si, o, w))
{
- const struct s_node *nq = fp->nv + np->ni;
+ const s_node *nq = fp->nv + np->ni;
if ((u = sol_test_node(t, U, up, fp, nq, o, w)) < t)
{
if (np->nj >= 0 && sol_test_back(t, up, fp->sv + np->si, o, w))
{
- const struct s_node *nq = fp->nv + np->nj;
+ const s_node *nq = fp->nv + np->nj;
if ((u = sol_test_node(t, U, up, fp, nq, o, w)) < t)
{
static float sol_test_body(float dt,
float T[3], float V[3],
- const struct s_ball *up,
- const struct s_file *fp,
- const struct s_body *bp)
+ const s_ball *up,
+ const s_file *fp,
+ const s_body *bp)
{
float U[3], O[3], E[4], W[3], A[3], u;
- const struct s_node *np = fp->nv + bp->ni;
+ const s_node *np = fp->nv + bp->ni;
sol_body_p(O, fp, bp->pi, bp->t);
sol_body_v(W, fp, bp->pi, bp->t, dt);
{
/* The body has a non-identity orientation or it is rotating. */
- struct s_ball ball;
+ s_ball ball;
float e[4], p0[3], p1[3];
const float z[3] = { 0 };
static float sol_test_file(float dt,
float T[3], float V[3],
- const struct s_ball *up,
- const struct s_file *fp)
+ const s_ball *up,
+ const s_file *fp)
{
float U[3], W[3], u, t = dt;
int i;
for (i = 0; i < fp->bc; i++)
{
- const struct s_body *bp = fp->bv + i;
+ const s_body *bp = fp->bv + i;
if ((u = sol_test_body(t, U, W, up, fp, bp)) < t)
{
* iterations, punt it.
*/
-float sol_step(struct s_file *fp, const float *g, float dt, int ui, int *m)
+float sol_step(s_file *fp, const float *g, float dt, int ui, int *m)
{
float P[3], V[3], v[3], r[3], a[3], d, e, nt, b = 0.0f, tt = dt;
int c;
if (ui < fp->uc)
{
- struct s_ball *up = fp->uv + ui;
+ s_ball *up = fp->uv + ui;
/* If the ball is in contact with a surface, apply friction. */
for (bi = 0; bi < fp->bc; bi++)
{
- struct s_body *bp = fp->bv + bi;
+ s_body *bp = fp->bv + bi;
if (bp->pi >= 0)
{
- struct s_path *pp = fp->pv + bp->pi;
+ s_path *pp = fp->pv + bp->pi;
if (!pp->f)
continue;
/*---------------------------------------------------------------------------*/
-void sol_init_sim(struct s_file *fp)
+void sol_init_sim(s_file *fp)
{
return;
}