summaryrefslogtreecommitdiff
path: root/core/math/plane.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/plane.cpp')
-rw-r--r--core/math/plane.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/math/plane.cpp b/core/math/plane.cpp
index 4200484c59..ae2021d2f6 100644
--- a/core/math/plane.cpp
+++ b/core/math/plane.cpp
@@ -31,6 +31,7 @@
#include "plane.h"
#include "core/math/math_funcs.h"
+#include "core/variant.h"
void Plane::set_normal(const Vector3 &p_normal) {
normal = p_normal;
@@ -138,6 +139,31 @@ bool Plane::intersects_segment(const Vector3 &p_begin, const Vector3 &p_end, Vec
return true;
}
+Variant Plane::intersect_3_bind(const Plane &p_plane1, const Plane &p_plane2) const {
+ Vector3 inters;
+ if (intersect_3(p_plane1, p_plane2, &inters)) {
+ return inters;
+ } else {
+ return Variant();
+ }
+}
+Variant Plane::intersects_ray_bind(const Vector3 &p_from, const Vector3 &p_dir) const {
+ Vector3 inters;
+ if (intersects_ray(p_from, p_dir, &inters)) {
+ return inters;
+ } else {
+ return Variant();
+ }
+}
+Variant Plane::intersects_segment_bind(const Vector3 &p_begin, const Vector3 &p_end) const {
+ Vector3 inters;
+ if (intersects_segment(p_begin, p_end, &inters)) {
+ return inters;
+ } else {
+ return Variant();
+ }
+}
+
/* misc */
bool Plane::is_equal_approx_any_side(const Plane &p_plane) const {