Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::Plane Class Reference

#include <Plane.h>

Public Member Functions

 AZ_TYPE_INFO (Plane, "{847DD984-9DBF-4789-8E25-E0334402E8AD}")
 
 Plane ()=default
 Default construction, no initialization.
 
 Plane (Simd::Vec4::FloatArgType plane)
 Construct from a simd vector representing a plane.
 
void Set (const Vector4 &plane)
 
void Set (const Vector3 &normal, float d)
 
void Set (float a, float b, float c, float d)
 
void SetNormal (const Vector3 &normal)
 
void SetDistance (float d)
 
Plane GetTransform (const Transform &tm) const
 Applies the specified transform to the plane, returns the transformed plane.
 
void ApplyTransform (const Transform &tm)
 
const Vector4GetPlaneEquationCoefficients () const
 Returns the coefficients of the plane equation as a Vector4, i.e. (A,B,C,D).
 
Vector3 GetNormal () const
 
float GetDistance () const
 
float GetPointDist (const Vector3 &pos) const
 Calculates the distance between a point and the plane.
 
Vector3 GetProjected (const Vector3 &v) const
 Project vector onto a plane.
 
bool CastRay (const Vector3 &start, const Vector3 &dir, Vector3 &hitPoint) const
 Returns true if ray plane intersect, otherwise false. If true hitPoint contains the result.
 
bool CastRay (const Vector3 &start, const Vector3 &dir, float &hitTime) const
 
bool IntersectSegment (const Vector3 &start, const Vector3 &end, Vector3 &hitPoint) const
 Intersect the plane with line segment. Return true if they intersect otherwise false.
 
bool IntersectSegment (const Vector3 &start, const Vector3 &end, float &hitTime) const
 
bool IsFinite () const
 
bool operator== (const Plane &rhs) const
 
bool operator!= (const Plane &rhs) const
 
Simd::Vec4::FloatType GetSimdValue () const
 Exposes the internal simd representation of the plane.
 

Static Public Member Functions

static void Reflect (ReflectContext *context)
 
static Plane CreateFromNormalAndPoint (const Vector3 &normal, const Vector3 &point)
 
static Plane CreateFromNormalAndDistance (const Vector3 &normal, float dist)
 
static Plane CreateFromCoefficients (const float a, const float b, const float c, const float d)
 
static Plane CreateFromTriangle (const Vector3 &v0, const Vector3 &v1, const Vector3 &v2)
 Assumes counter clockwise(right handed) winding.
 
static Plane CreateFromVectorCoefficients (const Vector4 &coefficients)
 

Detailed Description

Plane defined by a Vector4 with components (A,B,C,D), the plane equation used is Ax+By+Cz+D=0. The distance of a point from the plane is given by Ax+By+Cz+D, or just simply plane.Dot4(point).

Note that the D component is often referred to as 'distance' below, in the sense that it is the distance of the origin from the plane. This is not the same as what many other people refer to as the plane distance, which would be the negation of this.

Member Function Documentation

◆ CastRay()

AZ_MATH_INLINE bool AZ::Plane::CastRay ( const Vector3 start,
const Vector3 dir,
float &  hitTime 
) const

Returns true if ray plane intersect, otherwise false. If true hitTime contains the result. To produce the point of intersection using hitTime, hitPoint = start + dir * hitTime.

◆ IntersectSegment()

AZ_MATH_INLINE bool AZ::Plane::IntersectSegment ( const Vector3 start,
const Vector3 end,
float &  hitTime 
) const

Intersect the plane with line segment. Return true if they intersect otherwise false. To produce the point of intersection using hitTime, hitPoint = start + dir * hitTime.

◆ Reflect()

static void AZ::Plane::Reflect ( ReflectContext context)
static

AzCore Reflection.

Parameters
contextreflection context

The documentation for this class was generated from the following files: