TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
Math

Classes

struct  tachyon::quat
 A rotation, as a unit quaternion. More...
struct  tachyon::Ray
 A ray: from origin, along direction (length 1). More...

Functions

float tachyon::Dot (float3 a, float3 b)
float3 tachyon::Cross (float3 a, float3 b)
float tachyon::Length (float3 v)
float3 tachyon::Normalize (float3 v)
 v at length 1; zero stays zero.
float3 tachyon::Scale (float3 a, float3 b)
float4 tachyon::Mul (const float4x4 &m, float4 v)
float3 tachyon::TransformPoint (const float4x4 &m, float3 p)
 A point through m, divided by w.
float4x4 tachyon::Translation (float3 t)
float4x4 tachyon::TRS (float3 position, quat rotation, float3 scale)
 Scale, then rotate, then move: an object's transform in the world.
float4x4 tachyon::LookAt (float3 eye, float3 target, float3 up)
 The view matrix of a camera at eye looking at target, up roughly up.
float4x4 tachyon::Perspective (float fovY, float aspect, float nearZ, float farZ)
 A perspective projection to Vulkan's clip space: fovY in radians, aspect width over height.
float4x4 tachyon::ToClipSpace (float4x4 projection, GraphicsAPI api)
 A projection to Vulkan's clip space (Perspective, Orthographic) made one to api's: Direct3D's, Metal's and SDL GPU's (on every driver) have y up, so the y row is negated; depth runs 0 to 1 in all.
float4x4 tachyon::Orthographic (float height, float aspect, float nearZ, float farZ)
 An orthographic projection to Vulkan's clip space, height world units high.
float4x4 tachyon::Inverse (const float4x4 &m)
 m's inverse; the identity when it has none.
float tachyon::IntersectPlane (const Ray &ray, float3 point, float3 normal)
 How far along ray it meets the plane through point with normal; negative or NaN when it doesn't (parallel, or behind).
float tachyon::ClosestOnLine (const Ray &ray, float3 point, float3 direction)
 Where along the line through point with direction (length 1) it comes closest to ray; NaN when they're parallel.

Detailed Description

Function Documentation

◆ Dot()

float tachyon::Dot ( float3 a,
float3 b )
inline

◆ Cross()

float3 tachyon::Cross ( float3 a,
float3 b )
inline

◆ Length()

float tachyon::Length ( float3 v)
inline

◆ Normalize()

float3 tachyon::Normalize ( float3 v)
inline

#include <gui_core/gui_math3d.h>

v at length 1; zero stays zero.

◆ Scale()

float3 tachyon::Scale ( float3 a,
float3 b )
inline

◆ Mul()

float4 tachyon::Mul ( const float4x4 & m,
float4 v )
inline

◆ TransformPoint()

float3 tachyon::TransformPoint ( const float4x4 & m,
float3 p )
inline

#include <gui_core/gui_math3d.h>

A point through m, divided by w.

◆ Translation()

float4x4 tachyon::Translation ( float3 t)
inline

◆ TRS()

float4x4 tachyon::TRS ( float3 position,
quat rotation,
float3 scale )
inline

#include <gui_core/gui_math3d.h>

Scale, then rotate, then move: an object's transform in the world.

◆ LookAt()

float4x4 tachyon::LookAt ( float3 eye,
float3 target,
float3 up )
inline

#include <gui_core/gui_math3d.h>

The view matrix of a camera at eye looking at target, up roughly up.

◆ Perspective()

float4x4 tachyon::Perspective ( float fovY,
float aspect,
float nearZ,
float farZ )
inline

#include <gui_core/gui_math3d.h>

A perspective projection to Vulkan's clip space: fovY in radians, aspect width over height.

◆ ToClipSpace()

float4x4 tachyon::ToClipSpace ( float4x4 projection,
GraphicsAPI api )
inline

#include <gui_core/gui_math3d.h>

A projection to Vulkan's clip space (Perspective, Orthographic) made one to api's: Direct3D's, Metal's and SDL GPU's (on every driver) have y up, so the y row is negated; depth runs 0 to 1 in all.

◆ Orthographic()

float4x4 tachyon::Orthographic ( float height,
float aspect,
float nearZ,
float farZ )
inline

#include <gui_core/gui_math3d.h>

An orthographic projection to Vulkan's clip space, height world units high.

◆ Inverse()

float4x4 tachyon::Inverse ( const float4x4 & m)

#include <gui_core/gui_math3d.h>

m's inverse; the identity when it has none.

◆ IntersectPlane()

float tachyon::IntersectPlane ( const Ray & ray,
float3 point,
float3 normal )
inline

#include <gui_core/gui_math3d.h>

How far along ray it meets the plane through point with normal; negative or NaN when it doesn't (parallel, or behind).

◆ ClosestOnLine()

float tachyon::ClosestOnLine ( const Ray & ray,
float3 point,
float3 direction )
inline

#include <gui_core/gui_math3d.h>

Where along the line through point with direction (length 1) it comes closest to ray; NaN when they're parallel.