From 7f2923812fbd410d29dbbfb5e322e5176c804e0b Mon Sep 17 00:00:00 2001 From: Lucas GAUTHERON Date: Mon, 31 Oct 2011 15:47:13 +0000 Subject: [PATCH] physics: we should rather not use fast maths functions here (Brahma: please remove what can be removed) git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6680 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/geom.h | 6 +++--- source/src/physics.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/src/geom.h b/source/src/geom.h index 89b91737..977a3b21 100644 --- a/source/src/geom.h +++ b/source/src/geom.h @@ -86,8 +86,11 @@ struct vec float magnitude() const { return sqrtf(squaredlen()); } vec &normalize() { div(magnitude()); return *this; } + // should NOT be used float fmag() const { return fSqrt(squaredlen()); } float ufmag() const { return ufSqrt(squaredlen()); } + float fmagxy() const { return fSqrt(x*x + y*y); } + float ufmagxy() const { return ufSqrt(x*x + y*y); } float dist(const vec &e) const { vec t; return dist(e, t); } float dist(const vec &e, vec &t) const { t = *this; t.sub(e); return t.magnitude(); } @@ -95,9 +98,6 @@ struct vec float distxy(const vec &e) const { float dx = e.x - x, dy = e.y - y; return sqrtf(dx*dx + dy*dy); } float magnitudexy() const { return sqrtf(x*x + y*y); } - float fmagxy() const { return fSqrt(x*x + y*y); } - float ufmagxy() const { return ufSqrt(x*x + y*y); } - bool reject(const vec &o, float max) const { return x>o.x+max || xo.y+max || y= 0.0f ? diag : -diag), (d.x*ct2f+d.y >= 0.0f ? diag : -diag), 0); pl->o.x -= f*d.x; pl->o.y -= f*d.y;