diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-10 13:06:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-10 13:06:55 +0200 |
commit | 9cc67b19b8803adf3cb12364f1e3faade7553ebb (patch) | |
tree | e4741393cf3a0dd288bc2096c97471ea595340b0 /core/math/plane.cpp | |
parent | 2d8d311b1280c78e1ae70900186d5ae22a488828 (diff) | |
parent | ec7b481170dcd6a7b4cf0e6c1221e204ff7945f3 (diff) | |
download | redot-engine-9cc67b19b8803adf3cb12364f1e3faade7553ebb.tar.gz |
Merge pull request #38613 from MCrafterzz/plane
Renamed plane's d to distance
Diffstat (limited to 'core/math/plane.cpp')
-rw-r--r-- | core/math/plane.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/math/plane.cpp b/core/math/plane.cpp index a3818698bc..c375913756 100644 --- a/core/math/plane.cpp +++ b/core/math/plane.cpp @@ -45,7 +45,7 @@ void Plane::normalize() { return; } normal /= l; - d /= l; + distance /= l; } Plane Plane::normalized() const { @@ -57,7 +57,7 @@ Plane Plane::normalized() const { Vector3 Plane::get_any_point() const { - return get_normal() * d; + return get_normal() * distance; } 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.d) + - (vec3_cross(normal2, normal0) * p_plane1.d) + - (vec3_cross(normal0, normal1) * p_plane2.d)) / + *r_result = ((vec3_cross(normal1, normal2) * p_plane0.distance) + + (vec3_cross(normal2, normal0) * p_plane1.distance) + + (vec3_cross(normal0, normal1) * p_plane2.distance)) / 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) - d) / den; + real_t dist = (normal.dot(p_from) - distance) / 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) - d) / den; + real_t dist = (normal.dot(p_begin) - distance) / 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(d, p_plane.d); + return normal.is_equal_approx(p_plane.normal) && Math::is_equal_approx(distance, p_plane.distance); } Plane::operator String() const { - return normal.operator String() + ", " + rtos(d); + return normal.operator String() + ", " + rtos(distance); } |