2using System.Collections.Generic;
10 internal const int size = 16;
14 private float m_Distance;
59 m_Distance = 0f -
Vector3.
Dot(m_Normal, inPoint);
93 m_Distance = 0f -
Vector3.
Dot(inNormal, inPoint);
113 m_Normal = -m_Normal;
114 m_Distance = 0f - m_Distance;
123 m_Distance +=
Vector3.
Dot(m_Normal, translation);
136 return new Plane(plane.m_Normal, plane.m_Distance +=
Vector3.
Dot(plane.m_Normal, translation));
148 float d =
Vector3.
Dot(m_Normal, point) + m_Distance;
149 return point - m_Normal * d;
158 return Vector3.
Dot(m_Normal, point) + m_Distance;
167 return Vector3.
Dot(m_Normal, point) + m_Distance > 0f;
179 return (distanceToPoint > 0f && distanceToPoint2 > 0f) || (distanceToPoint <= 0f && distanceToPoint2 <= 0f);
197 return String.Format(
"(normal:({0:F1}, {1:F1}, {2:F1}), distance:{3:F1})", m_Normal.
x, m_Normal.
y, m_Normal.
z, m_Distance);
202 return String.Format(
"(normal:({0}, {1}, {2}), distance:{3})", m_Normal.
x.ToString(format), m_Normal.
y.ToString(format), m_Normal.
z.ToString(format), m_Distance.ToString(format));
static bool Approximately(float a, float b)
string ToString(string format)
float GetDistanceToPoint(Vector3 point)
Vector3 ClosestPointOnPlane(Vector3 point)
Plane(Vector3 a, Vector3 b, Vector3 c)
void Set3Points(Vector3 a, Vector3 b, Vector3 c)
void SetNormalAndPosition(Vector3 inNormal, Vector3 inPoint)
Plane(Vector3 inNormal, float d)
void Translate(Vector3 translation)
static Plane Translate(Plane plane, Vector3 translation)
bool Raycast(Ray ray, out float enter)
bool SameSide(Vector3 inPt0, Vector3 inPt1)
Plane(Vector3 inNormal, Vector3 inPoint)
bool GetSide(Vector3 point)
override string ToString()
static Vector3 Normalize(Vector3 value)
static float Dot(Vector3 lhs, Vector3 rhs)
static Vector3 Cross(Vector3 lhs, Vector3 rhs)