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
270 glm::vec3 axisDir = glm::normalize(axis);270 glm::vec3 axisDir = glm::normalize(axis);
271 for (size_t i = 0; i < points.size(); i++) {271 for (size_t i = 0; i < points.size(); i++) {
272 float dot = glm::dot(points[i], axisDir);272 float dot = glm::dot(points[i], axisDir);
273 float distance = glm::length(points[i]);
274 if (dot > 0.0f) {273 if (dot > 0.0f) {
275 float distancePow = glm::pow(distance, 2);274 float distancePow = glm::distance2(Vectors::ZERO, points[i]);
276 float dotPow = glm::pow(dot, 2);275 float dotPow = glm::pow(dot, 2);
277 float radius = (dot / maxDistance) * glm::sqrt(distancePow - dotPow);276 float radius = (dot / maxDistance) * glm::sqrt(distancePow - dotPow);
278 averageRadius += radius;277 averageRadius += radius;