summaryrefslogtreecommitdiff
path: root/core/math/geometry_3d.cpp
diff options
context:
space:
mode:
authormennomax <mennomax@outlook.de>2021-04-08 16:26:14 +0200
committerAaron Franke <arnfranke@yahoo.com>2021-10-15 20:49:42 -0500
commitb4eeeb315a74682d299c7ec1555ce06a9dc2641a (patch)
tree4efb789ff3d5673c38dc439eb91127870183f392 /core/math/geometry_3d.cpp
parent96410f55b24e47af045e3ad31545331ce124d999 (diff)
Swap args of Plane(point, normal) constructor
Now (normal, point)
Diffstat (limited to 'core/math/geometry_3d.cpp')
-rw-r--r--core/math/geometry_3d.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/core/math/geometry_3d.cpp b/core/math/geometry_3d.cpp
index 6628b760e0..88d2656025 100644
--- a/core/math/geometry_3d.cpp
+++ b/core/math/geometry_3d.cpp
@@ -819,11 +819,9 @@ Vector<Plane> Geometry3D::build_sphere_planes(real_t p_radius, int p_lats, int p
planes.push_back(Plane(normal, p_radius));
for (int j = 1; j <= p_lats; j++) {
- // FIXME: This is stupid.
- Vector3 angle = normal.lerp(axis, j / (real_t)p_lats).normalized();
- Vector3 pos = angle * p_radius;
- planes.push_back(Plane(pos, angle));
- planes.push_back(Plane(pos * axis_neg, angle * axis_neg));
+ Vector3 plane_normal = normal.lerp(axis, j / (real_t)p_lats).normalized();
+ planes.push_back(Plane(plane_normal, p_radius));
+ planes.push_back(Plane(plane_normal * axis_neg, p_radius));
}
}
@@ -852,10 +850,10 @@ Vector<Plane> Geometry3D::build_capsule_planes(real_t p_radius, real_t p_height,
planes.push_back(Plane(normal, p_radius));
for (int j = 1; j <= p_lats; j++) {
- Vector3 angle = normal.lerp(axis, j / (real_t)p_lats).normalized();
- Vector3 pos = axis * p_height * 0.5 + angle * p_radius;
- planes.push_back(Plane(pos, angle));
- planes.push_back(Plane(pos * axis_neg, angle * axis_neg));
+ Vector3 plane_normal = normal.lerp(axis, j / (real_t)p_lats).normalized();
+ Vector3 position = axis * p_height * 0.5 + plane_normal * p_radius;
+ planes.push_back(Plane(plane_normal, position));
+ planes.push_back(Plane(plane_normal * axis_neg, position * axis_neg));
}
}