History

Optimization

luiscuenca committed 7 years ago

Commit 70d0ebf1 parent a6dce5d1 file · +1 −2Browse files

Showing the changes to libraries/physics/src/MultiSphereShape.cpp (1 of 1 file). Show all

Unified · Split

libraries/physics/src/MultiSphereShape.cpp+1−2
@@ -270,9 +270,8 @@ void MultiSphereShape::spheresFromAxes(const std::vector<glm::vec3>& points, con · 269 unmodified lines
270270 glm::vec3 axisDir = glm::normalize(axis);
271271 for (size_t i = 0; i < points.size(); i++) {
272272 float dot = glm::dot(points[i], axisDir);
273− float distance = glm::length(points[i]);
274273 if (dot > 0.0f) {
275− float distancePow = glm::pow(distance, 2);
274+ float distancePow = glm::distance2(Vectors::ZERO, points[i]);
276275 float dotPow = glm::pow(dot, 2);
277276 float radius = (dot / maxDistance) * glm::sqrt(distancePow - dotPow);
278277 averageRadius += radius;