diff options
| -rw-r--r-- | v3f.h | 19 | 
1 files changed, 19 insertions, 0 deletions
| @@ -209,4 +209,23 @@ static inline v3f_t * v3f_nlerp(v3f_t *res, const v3f_t *a, const v3f_t *b, floa  } +static inline v3f_t _v3f_cross(const v3f_t *a, const v3f_t *b) +{ +	return (v3f_t){ +		.x = a->y * b->z - a->z * b->y, +		.y = a->z * b->x - a->x * b->z, +		.z = a->x * b->y - a->y * b->x, +	}; +} + + +static inline v3f_t * v3f_cross(v3f_t *res, const v3f_t *a, const v3f_t *b) +{ +	if (_v3f_allocated(&res)) +		*res = _v3f_cross(a, b); + +	return res; +} + +  #endif | 
