]> git.itanic.dy.fi Git - sdl-planets/blobdiff - vector.h
vector.h: Introduce vector_abs_squared()
[sdl-planets] / vector.h
index 875cd3579f156faa03d1a3aa35413a5dd5e372d5..d3e265cb948b62316ef52ab2ae75f6b9fa573e33 100644 (file)
--- a/vector.h
+++ b/vector.h
@@ -33,6 +33,11 @@ static inline double vector_abs(const struct vector *a)
        return sqrt(a->x * a->x + a->y * a->y);
 }
 
+static inline double vector_abs_squared(const struct vector *a)
+{
+       return a->x * a->x + a->y * a->y;
+}
+
 static inline void vector_scale(const struct vector *a, const double b,
                                struct vector *res)
 {