summaryrefslogtreecommitdiffstats
path: root/core/math/plane.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-10 16:47:11 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-10 16:47:11 +0200
commit94721f5ab8af9e7d91a4de58baf2c8d849ceab6e (patch)
tree92fb34d709310b76de1c2d45cfe2aad8db7a523a /core/math/plane.cpp
parent6ab92464bc6356f3342c3efd1fc1bb1a5e4467d5 (diff)
downloadredot-engine-94721f5ab8af9e7d91a4de58baf2c8d849ceab6e.tar.gz
Revert "Renamed plane's d to distance"
This reverts commit ec7b481170dcd6a7b4cf0e6c1221e204ff7945f3. This was wrong, `d` is not a distance but the `d` constant in the parametric equation `ax + by + cz = d` describing the plane.
Diffstat (limited to 'core/math/plane.cpp')
-rw-r--r--core/math/plane.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index c375913756..a3818698bc 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -45,7 +45,7 @@ void Plane::normalize() {
return;
}
normal /= l;
- distance /= l;
+ d /= l;
}
Plane Plane::normalized() const {
@@ -57,7 +57,7 @@ Plane Plane::normalized() const {
Vector3 Plane::get_any_point() const {
- return get_normal() * distance;
+ return get_normal() * d;
}
Vector3 Plane::get_any_perpendicular_normal() const {
@@ -92,9 +92,9 @@ bool Plane::intersect_3(const Plane &p_plane1, const Plane &p_plane2, Vector3 *r
return false;
if (r_result) {
- *r_result = ((vec3_cross(normal1, normal2) * p_plane0.distance) +
- (vec3_cross(normal2, normal0) * p_plane1.distance) +
- (vec3_cross(normal0, normal1) * p_plane2.distance)) /
+ *r_result = ((vec3_cross(normal1, normal2) * p_plane0.d) +
+ (vec3_cross(normal2, normal0) * p_plane1.d) +
+ (vec3_cross(normal0, normal1) * p_plane2.d)) /
denom;
}
@@ -112,7 +112,7 @@ bool Plane::intersects_ray(const Vector3 &p_from, const Vector3 &p_dir, Vector3
return false;
}
- real_t dist = (normal.dot(p_from) - distance) / den;
+ real_t dist = (normal.dot(p_from) - d) / den;
//printf("dist is %i\n",dist);
if (dist > CMP_EPSILON) { //this is a ray, before the emitting pos (p_from) doesn't exist
@@ -137,7 +137,7 @@ bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vec
return false;
}
- real_t dist = (normal.dot(p_begin) - distance) / den;
+ real_t dist = (normal.dot(p_begin) - d) / den;
//printf("dist is %i\n",dist);
if (dist < -CMP_EPSILON || dist > (1.0 + CMP_EPSILON)) {
@@ -155,10 +155,10 @@ bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vec
bool Plane::is_equal_approx(const Plane &p_plane) const {
- return normal.is_equal_approx(p_plane.normal) && Math::is_equal_approx(distance, p_plane.distance);
+ return normal.is_equal_approx(p_plane.normal) && Math::is_equal_approx(d, p_plane.d);
}
Plane::operator String() const {
- return normal.operator String() + ", " + rtos(distance);
+ return normal.operator String() + ", " + rtos(d);
}