42 void set_normal(
const Vector3& p_normal);
43 _FORCE_INLINE_
Vector3 get_normal()
const {
return normal; };
46 Plane normalized()
const;
50 _FORCE_INLINE_
Vector3 center()
const {
return normal*d; }
52 Vector3 get_any_perpendicular_normal()
const;
55 _FORCE_INLINE_ real_t distance_to(
const Vector3 &p_point)
const;
56 _FORCE_INLINE_
bool has_point(
const Vector3 &p_point,real_t _epsilon=CMP_EPSILON)
const;
60 bool intersect_3(
const Plane &p_plane1,
const Plane &p_plane2,
Vector3 *r_result=0)
const;
66 return p_point - normal * distance_to(p_point);
71 Plane operator-()
const {
return Plane(-normal,-d); }
72 bool is_almost_like(
const Plane& p_plane)
const;
74 _FORCE_INLINE_
bool operator==(
const Plane& p_plane)
const;
75 _FORCE_INLINE_
bool operator!=(
const Plane& p_plane)
const;
78 _FORCE_INLINE_
Plane() { d=0; }
79 _FORCE_INLINE_
Plane(real_t p_a, real_t p_b, real_t p_c, real_t p_d) : normal(p_a,p_b,p_c), d(p_d) { };
81 _FORCE_INLINE_ Plane(
const Vector3 &p_normal, real_t p_d);
82 _FORCE_INLINE_ Plane(
const Vector3 &p_point,
const Vector3& p_normal);
83 _FORCE_INLINE_ Plane(
const Vector3 &p_point1,
const Vector3 &p_point2,
const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE);
92 return (normal.dot(p_point) > d);
95 real_t Plane::distance_to(
const Vector3 &p_point)
const {
97 return (normal.dot(p_point)-d);
100 bool Plane::has_point(
const Vector3 &p_point,real_t _epsilon)
const {
102 float dist=normal.dot(p_point) - d;
104 return ( dist <= _epsilon);
108 Plane::Plane(
const Vector3 &p_normal, real_t p_d) {
117 d=p_normal.dot(p_point);
120 Plane::Plane(
const Vector3 &p_point1,
const Vector3 &p_point2,
const Vector3 &p_point3,ClockDirection p_dir) {
122 if (p_dir == CLOCKWISE)
123 normal=(p_point1-p_point3).cross(p_point1-p_point2);
125 normal=(p_point1-p_point2).cross(p_point1-p_point3);
129 d = normal.dot(p_point1);
134 bool Plane::operator==(
const Plane& p_plane)
const {
136 return normal==p_plane.normal && d == p_plane.d;
139 bool Plane::operator!=(
const Plane& p_plane)
const {
141 return normal!=p_plane.normal || d != p_plane.d;
void normalize()
Point is coplanar, CMP_EPSILON for precision.
Definition: plane.cpp:41
_FORCE_INLINE_ bool is_point_over(const Vector3 &p_point) const
Point is over plane.
Definition: plane.h:90