Plane#
-
class Plane : public XVector4<float>#
3D plane representation in the form ax + by + cz + d = 0.
This class represents a 3D plane using the implicit equation ax + by + cz + d = 0, where (a, b, c) is the plane normal and d is the distance from origin. It inherits from Vec4 where x, y, z represent the normal components and w represents -d.
Public Types
-
typedef float value_type#
Type alias for the template parameter T.
Public Functions
-
inline Plane()#
Default constructor creating an uninitialized plane.
-
inline Plane(float x, float y, float z, float w)#
Constructor from plane equation coefficients.
- Parameters:
x – [in] Normal x-component (coefficient a)
y – [in] Normal y-component (coefficient b)
z – [in] Normal z-component (coefficient c)
w – [in] Negative distance from origin (coefficient d)
-
inline Plane(const Vec3 &p, const Vector3 &n)#
Constructor from point on plane and normal vector.
- Parameters:
p – [in] A point lying on the plane
n – [in] Normal vector to the plane
-
inline Vec3 GetNormal() const#
Gets the normal vector of the plane.
- Returns:
The plane’s normal vector
-
inline Vec3 GetPoint() const#
Gets a point on the plane closest to the origin.
- Returns:
A point on the plane
-
inline Plane(const Vec3 &v)#
Constructor from Vec3 (assumes w=1).
- Parameters:
v – [in] Vector containing normal components
-
inline Plane(const Vec4 &v)#
Constructor from Vec4.
- Parameters:
v – [in] Vector containing plane equation coefficients
-
inline operator float*()#
Conversion operator to non-const pointer to components.
- Returns:
Pointer to the first component (x)
-
inline operator const float*() const#
Conversion operator to const pointer to components.
- Returns:
Const pointer to the first component (x)
-
inline void Set(float x_, float y_, float z_, float w_)#
Sets all four components of the vector.
- Parameters:
x_ – [in] New x component value
y_ – [in] New y component value
z_ – [in] New z component value
w_ – [in] New w component value
-
inline XVector4<float> operator*(float scale) const#
Scalar multiplication operator.
- Parameters:
scale – [in] Scalar value to multiply with
- Returns:
New vector with each component multiplied by scale
-
inline XVector4<float> operator*(XVector4<float> scale) const#
Component-wise vector multiplication operator.
- Parameters:
scale – [in] Vector to multiply component-wise
- Returns:
New vector with components multiplied element-wise
-
inline XVector4<float> operator/(float scale) const#
Scalar division operator.
- Parameters:
scale – [in] Scalar value to divide by
- Returns:
New vector with each component divided by scale
-
inline XVector4<float> operator+(const XVector4<float> &v) const#
Vector addition operator.
- Parameters:
v – [in] Vector to add
- Returns:
New vector that is the sum of this vector and v
-
inline XVector4<float> operator-(const XVector4<float> &v) const#
Vector subtraction operator.
- Parameters:
v – [in] Vector to subtract
- Returns:
New vector that is the difference of this vector and v
-
inline XVector4<float> operator-() const#
Unary negation operator.
- Returns:
New vector with all components negated
-
inline XVector4<float> &operator*=(float scale)#
Scalar multiplication assignment operator.
- Parameters:
scale – [in] Scalar value to multiply with
- Returns:
Reference to this vector after multiplication
-
inline XVector4<float> &operator*=(const XVector4<float> &v)#
Component-wise vector multiplication assignment operator.
- Parameters:
v – [in] Vector to multiply component-wise
- Returns:
Reference to this vector after component-wise multiplication
-
inline XVector4<float> &operator/=(float scale)#
Scalar division assignment operator.
- Parameters:
scale – [in] Scalar value to divide by
- Returns:
Reference to this vector after division
-
inline XVector4<float> &operator+=(const XVector4<float> &v)#
Vector addition assignment operator.
- Parameters:
v – [in] Vector to add
- Returns:
Reference to this vector after addition
-
typedef float value_type#