LkEngine 0.1.2
 
Loading...
Searching...
No Matches
Math.h File Reference

Mathematics used by the engine. More...

#include <random>
#include <time.h>
#include <glm/glm.hpp>
#include <glm/ext/matrix_common.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtx/rotate_vector.hpp>
#include <glm/gtx/vector_angle.hpp>
#include <glm/gtx/norm.hpp>
#include "LkEngine/Core/Core.h"
#include "LkEngine/Core/Math/Vector.h"
#include "LkEngine/Core/Math/Rotator.h"
#include "LkEngine/Core/Math/Quaternion.h"

Go to the source code of this file.

Namespaces

namespace  LkEngine
 
enum class  Shape {
  None = 0 , Rectangle , Circle , Triangle ,
  Hexagon
}
 
FORCEINLINE glm::vec3 LkEngine::Math::Scale (glm::vec3 &Vector, const float ScaleFactor)
 Scale a vector.
 
FORCEINLINE bool LkEngine::Math::DecomposeTransform (const glm::mat4 &Transform, glm::vec3 &Translation, glm::quat &Rotation, glm::vec3 &Scale)
 Decompose a transform.
 
FORCEINLINE glm::mat4 LkEngine::Math::TransformMatrix (glm::vec3 &Translation, glm::quat &Rotation, glm::vec3 &Scale)
 Calculate a transform matrix.
 
glm::mat4 LkEngine::Math::TransformMatrix2D (const glm::vec3 &translation, float rot, const glm::vec3 &scale)
 
template<typename T = float>
glm::vec2 LkEngine::Math::ConvertToWorldCoordinates (glm::vec2 NdcCoordinates, T WindowWidth, T WindowHeight)
 Calculate world coordinates.
 
template<typename TVector >
FORCEINLINE TVector LkEngine::Math::ScreenToWorldCoordinates2D (const TVector &ScreenCoordinates, const glm::mat4 &InverseProjectionMatrix, const glm::mat4 &InverseViewMatrix, const glm::vec4 &Viewport)
 Convert screen coordinates to its world counterpart in 2D.
 
template<typename TVector = glm::vec3, typename TVec2 >
FORCEINLINE TVector LkEngine::Math::ConvertScreenToWorldCoordinates (const TVec2 &ScreenCoordinates, const float Depth, const glm::mat4 &ViewMatrix, const glm::mat4 &ProjectionMatrix, const glm::vec4 &Viewport)
 Convert screen coordinates to its world counterpart.
 
glm::vec2 LkEngine::Math::ScreenToWorld2D (const glm::vec2 &ndc, const glm::mat4 &inv_proj, const LTransformComponent &Transform)
 
float LkEngine::Math::Get2DRotationFromQuaternion (const glm::quat &quat)
 
template<typename TVector >
FORCEINLINE TVector LkEngine::Math::GetForwardVector (const glm::mat4 &TransformMatrix)
 Calculate the forward vector from a transform matrix.
 
template<typename TVector >
FORCEINLINE TVector LkEngine::Math::GetRightVector (const glm::mat4 &TransformMatrix)
 Calculate the right vector from a transform matrix.
 
template<typename TVector >
FORCEINLINE TVector LkEngine::Math::Normalize (const TVector &InVector)
 

Detailed Description

Mathematics used by the engine.

Function Documentation

◆ GetForwardVector()

template<typename TVector >
FORCEINLINE TVector LkEngine::Math::GetForwardVector ( const glm::mat4 & TransformMatrix)

Calculate the forward vector from a transform matrix.

Returns
The calculated forward vector of type TVector.

◆ GetRightVector()

template<typename TVector >
FORCEINLINE TVector LkEngine::Math::GetRightVector ( const glm::mat4 & TransformMatrix)

Calculate the right vector from a transform matrix.

Returns
The calculated right vector of type TVector.

◆ ScreenToWorldCoordinates2D()

template<typename TVector >
FORCEINLINE TVector LkEngine::Math::ScreenToWorldCoordinates2D ( const TVector & ScreenCoordinates,
const glm::mat4 & InverseProjectionMatrix,
const glm::mat4 & InverseViewMatrix,
const glm::vec4 & Viewport )

Convert screen coordinates to its world counterpart in 2D.

Deprecated
No longer used.