lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
Loading...
Searching...
No Matches
lmgl::scene::Plane Struct Reference

Plane structure. More...

#include <frustum.hpp>

Public Member Functions

 Plane ()
 Default constructor initializing a horizontal plane at the origin.
 
 Plane (const glm::vec3 &normal, float distance)
 Parameterized constructor.
 
 Plane (const glm::vec3 &point, const glm::vec3 &normal)
 Construct a plane from a point and a normal vector.
 
float distance_to_point (const glm::vec3 &point) const
 Calculate the distance from a point to the plane.
 
void normalize ()
 Normalize the plane equation.
 

Public Attributes

glm::vec3 normal
 Normal vector of the plane.
 
float distance
 Distance from the origin to the plane along the normal.
 

Detailed Description

Plane structure.

Represents a plane in 3D space defined by a normal vector and a distance from the origin. Provides methods for calculating the distance from a point to the plane and for normalizing the plane equation.

Constructor & Destructor Documentation

◆ Plane() [1/3]

lmgl::scene::Plane::Plane ( )
inline

Default constructor initializing a horizontal plane at the origin.

Initializes the normal to (0, 1, 0) and distance to 0.

◆ Plane() [2/3]

lmgl::scene::Plane::Plane ( const glm::vec3 & normal,
float distance )
inline

Parameterized constructor.

Initializes the plane with specified normal and distance.

Parameters
normalNormal vector of the plane.
distanceDistance from the origin to the plane.

◆ Plane() [3/3]

lmgl::scene::Plane::Plane ( const glm::vec3 & point,
const glm::vec3 & normal )
inline

Construct a plane from a point and a normal vector.

Initializes the plane such that it passes through the given point with the specified normal vector.

Parameters
pointA point on the plane.
normalNormal vector of the plane.

Member Function Documentation

◆ distance_to_point()

float lmgl::scene::Plane::distance_to_point ( const glm::vec3 & point) const
inline

Calculate the distance from a point to the plane.

Computes the signed distance from the specified point to the plane.

Parameters
pointThe point to measure the distance to.
Returns
Signed distance from the point to the plane.

◆ normalize()

void lmgl::scene::Plane::normalize ( )

Normalize the plane equation.

Normalizes the plane's normal vector and adjusts the distance accordingly.


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