aboutsummaryrefslogtreecommitdiff
path: root/tools/lighthousefind_tori/torus_localizer.c
diff options
context:
space:
mode:
authorMike Turvey <mturvey6@gmail.com>2017-02-15 22:55:23 -0700
committermwturvey <michael.w.turvey@intel.com>2017-02-21 13:29:40 -0700
commitbb099f0fd084c3a2f84532e76928a4f548bf188e (patch)
treec60853c2811b8caca2d66b619a5dc60c79df82b8 /tools/lighthousefind_tori/torus_localizer.c
parent93873b616394b24fefb0ce17ae0e302ff2697d14 (diff)
downloadlibsurvive-bb099f0fd084c3a2f84532e76928a4f548bf188e.tar.gz
libsurvive-bb099f0fd084c3a2f84532e76928a4f548bf188e.tar.bz2
Eliminate unnecessary pow calls.
Diffstat (limited to 'tools/lighthousefind_tori/torus_localizer.c')
-rw-r--r--tools/lighthousefind_tori/torus_localizer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/lighthousefind_tori/torus_localizer.c b/tools/lighthousefind_tori/torus_localizer.c
index 837b745..c539fb5 100644
--- a/tools/lighthousefind_tori/torus_localizer.c
+++ b/tools/lighthousefind_tori/torus_localizer.c
@@ -122,7 +122,7 @@ void partialTorusGenerator(
toroidalRadius = distanceBetweenPoints / (2 * tan(lighthouseAngle));
- poloidalRadius = sqrt(pow(toroidalRadius, 2) + pow(distanceBetweenPoints / 2, 2));
+ poloidalRadius = sqrt(SQUARED(toroidalRadius) + SQUARED(distanceBetweenPoints / 2));
double poloidalPrecision = M_PI * 2 / toroidalPrecision;
@@ -291,7 +291,7 @@ void estimateToroidalAndPoloidalAngleOfPoint(
// I stole these lines from the torus generator. Gonna need the poloidal radius.
double distanceBetweenPoints = distance(torusP1, torusP2); // we don't care about the coordinate system of these points because we're just getting distance.
double toroidalRadius = distanceBetweenPoints / (2 * tan(lighthouseAngle));
- double poloidalRadius = sqrt(pow(toroidalRadius, 2) + pow(distanceBetweenPoints / 2, 2));
+ double poloidalRadius = sqrt(SQUARED(toroidalRadius) + SQUARED(distanceBetweenPoints / 2));
// The center of the polidal circle already lies on the z axis at this point, so we won't shift z at all.
// The shift along the X axis will be the toroidal radius.
@@ -533,7 +533,7 @@ Point calculateTorusPointFromAngles(PointsAndAngle *pna, double toroidalAngle, d
Matrix3x3 rot = GetRotationMatrixForTorus(pna->a, pna->b);
double toroidalRadius = distanceBetweenPoints / (2 * tan(pna->angle));
- double poloidalRadius = sqrt(pow(toroidalRadius, 2) + pow(distanceBetweenPoints / 2, 2));
+ double poloidalRadius = sqrt(SQUARED(toroidalRadius) + SQUARED(distanceBetweenPoints / 2));
result.x = (toroidalRadius + poloidalRadius*cos(poloidalAngle))*cos(toroidalAngle);
result.y = (toroidalRadius + poloidalRadius*cos(poloidalAngle))*sin(toroidalAngle);
@@ -808,7 +808,7 @@ void AnalyzeToroidalImpact(
toroidalRadius = distanceBetweenPoints / (2 * tan(lighthouseAngle));
- poloidalRadius = sqrt(pow(toroidalRadius, 2) + pow(distanceBetweenPoints / 2, 2));
+ poloidalRadius = sqrt(SQUARED(toroidalRadius) + SQUARED(distanceBetweenPoints / 2));
unsigned int pointCount = 0;