16#include "SphereClass.h"
23 PlaneClass() : N(0.0f, 0.0f, 1.0f), D(0.0f) {};
25 PlaneClass(
float nx,
float ny,
float nz,
float dist)
27 Set(nx, ny, nz, dist);
30 PlaneClass(
const Vector3& normal,
float dist)
35 PlaneClass(
const Vector3& normal,
const Vector3& point)
40 PlaneClass(
const Vector3& point1,
const Vector3& point2,
const Vector3& point3)
42 Set(point1, point2, point3);
45 inline void Set(
float a,
float b,
float c,
float d)
53 inline void Set(
const Vector3& normal,
float dist)
59 inline void Set(
const Vector3& normal,
const Vector3& point)
62 D = Vector3::Dot_Product(normal, point);
65 inline void Set(
const Vector3& point1,
const Vector3& point2,
const Vector3& point3)
67 N = Vector3::Cross_Product((point2 - point1), (point3 - point1));
68 if (N != Vector3(0.0f, 0.0f, 0.0f)) {
74 N = Vector3(0.0f, 0.0f, 1.0f);
79 inline void Normalize()
81 float oolength = 1.0f / N.Length();
86 inline PlaneClass operator - ()
88 return PlaneClass(-N, D);
90 bool In_Front(
const Vector3 & point)
const;
91 bool In_Front(
const SphereClass & sphere)
const;
92 bool Compute_Intersection(
const Vector3 & p0,
const Vector3 & p1,
float * set_t)
const;
94inline bool PlaneClass::In_Front(
const Vector3 & point)
const
96 float dist = Vector3::Dot_Product(point,N);
99inline bool PlaneClass::In_Front(
const SphereClass & sphere)
const
101 float dist = Vector3::Dot_Product(sphere.Center,N);
102 return ((dist - D) >= sphere.Radius);
104inline bool PlaneClass::Compute_Intersection(
const Vector3 & p0,
const Vector3 & p1,
float * set_t)
const
107 den = Vector3::Dot_Product(N,p1-p0);
112 num = -(Vector3::Dot_Product(N,p0) - D);
114 if ((*set_t < 0.0f) || (*set_t > 1.0f))