32 #include "NE10_types.h" 50 ne10_float32_t x = (T.c2.r2 * v.x - T.c2.r1 * v.y) + T.c1.r1;
51 ne10_float32_t y = (T.c2.r1 * v.x + T.c2.r2 * v.y) + T.c1.r2;
57 static inline ne10_float32_t min (
float a, ne10_float32_t b)
68 static inline ne10_float32_t max (
float a, ne10_float32_t b)
99 ne10_uint32_t vertex_count)
101 ne10_vec2f_t lower = ne10_mul_matvec_float (*xf, vertices[0]);
106 for (i = 1; i < vertex_count; ++i)
108 v = ne10_mul_matvec_float (*xf, vertices[i]);
109 lower = min_2f (lower, v);
110 upper = max_2f (upper, v);
113 aabb->c1.r1 = lower.x - radius->x;
114 aabb->c1.r2 = lower.y - radius->y;
115 aabb->c2.r1 = upper.x + radius->x;
116 aabb->c2.r2 = upper.y + radius->y;
143 for (i = 0; i < count; i++)
145 va.x = v_wa->x - v_wa->z * ra->y;
146 va.y = v_wa->y + v_wa->z * ra->x;
147 vb.x = v_wb->x - v_wb->z * rb->y;
148 vb.y = v_wb->y + v_wb->z * rb->x;
187 for (i = 0; i < count; i++)
189 v_wa->x -= ima->x * p->x;
190 v_wa->y -= ima->x * p->y;
191 v_wa->z -= ima->y * (ra->x * p->y - ra->y * p->x);
193 v_wb->x += imb->x * p->x;
194 v_wb->y += imb->x * p->y;
195 v_wb->z += imb->y * (rb->x * p->y - rb->y * p->x);
a 2-tuple of ne10_float32_t values.
void ne10_physics_apply_impulse_vec2f_c(ne10_vec3f_t *v_wa, ne10_vec3f_t *v_wb, ne10_vec2f_t *ra, ne10_vec2f_t *rb, ne10_vec2f_t *ima, ne10_vec2f_t *imb, ne10_vec2f_t *p, ne10_uint32_t count)
apply contact impulse.
void ne10_physics_compute_aabb_vec2f_c(ne10_mat2x2f_t *aabb, ne10_vec2f_t *vertices, ne10_mat2x2f_t *xf, ne10_vec2f_t *radius, ne10_uint32_t vertex_count)
compute AABB for ploygon.
void ne10_physics_relative_v_vec2f_c(ne10_vec2f_t *dv, ne10_vec3f_t *v_wa, ne10_vec2f_t *ra, ne10_vec3f_t *v_wb, ne10_vec2f_t *rb, ne10_uint32_t count)
calculate relative velocity at contact.
a 3-tuple of ne10_float32_t values.