Is there a better way to write and possibly optimize this?
// a and b are objects with a shape attribute which is an enum value
// the shape enum value is either a circle or polygon
if (a->shape == CIRCLE && b->shape == CIRCLE)
collide_circle_x_circle(a, b);
else if (a->shape == CIRCLE && b->shape == POLYGON)
collide_polygon_x_circle(b, a);
else if (a->shape == POLYGON && b->shape == CIRCLE)
collide_polygon_x_circle(a, b);
else if (a->shape == POLYGON && b->shape == POLYGON)
collide_polygon_x_polygon(a, b);
// these last 4 if-else branches are controlled if collision happened
if (collision) {
if (a->shape == CIRCLE && b->shape == CIRCLE)
contact_circle_x_circle(a, b);
else if (a->shape == CIRCLE && b->shape == POLYGON)
contact_polygon_x_circle(b, a);
else if (a->shape == POLYGON && b->shape == CIRCLE)
contact_polygon_x_circle(a, b);
else if (a->shape == POLYGON && b->shape == POLYGON)
contact_polygon_x_polygon(a, b);