From 70d0ebfbec0e3db4c0944f12007ee4e6dc63fe4c Mon Sep 17 00:00:00 2001 From: luiscuenca Date: Mon, 28 Jan 2019 18:39:16 -0700 Subject: [PATCH] Optimization --- libraries/physics/src/MultiSphereShape.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/physics/src/MultiSphereShape.cpp b/libraries/physics/src/MultiSphereShape.cpp index 98fb6dd34d..549c8042d5 100644 --- a/libraries/physics/src/MultiSphereShape.cpp +++ b/libraries/physics/src/MultiSphereShape.cpp @@ -270,9 +270,8 @@ void MultiSphereShape::spheresFromAxes(const std::vector& points, con glm::vec3 axisDir = glm::normalize(axis); for (size_t i = 0; i < points.size(); i++) { float dot = glm::dot(points[i], axisDir); - float distance = glm::length(points[i]); if (dot > 0.0f) { - float distancePow = glm::pow(distance, 2); + float distancePow = glm::distance2(Vectors::ZERO, points[i]); float dotPow = glm::pow(dot, 2); float radius = (dot / maxDistance) * glm::sqrt(distancePow - dotPow); averageRadius += radius;