/** * graphene_vec4_normalize: * @v: a #graphene_vec4_t * @res: (out caller-allocates): return location for the normalized * vector * * Normalizes the given #graphene_vec4_t. * * Since: 1.0 */ void graphene_vec4_normalize (const graphene_vec4_t *v, graphene_vec4_t *res) { if (graphene_vec4_length (v) != 0.f) res->value = graphene_simd4f_normalize4 (v->value); else res->value = graphene_simd4f_init_zero (); }
/** * graphene_quaternion_normalize: * @q: a #graphene_quaternion_t * @res: (out caller-allocates): return location for the normalized * quaternion * * Normalizes a #graphene_quaternion_t. * * Since: 1.0 */ void graphene_quaternion_normalize (const graphene_quaternion_t *q, graphene_quaternion_t *res) { graphene_simd4f_t v_q; v_q = graphene_simd4f_init (q->x, q->y, q->z, q->w); v_q = graphene_simd4f_normalize4 (v_q); graphene_quaternion_init_from_simd4f (res, v_q); }