Ketchup Engine
Loading...
Searching...
No Matches
KMath Class Reference

#include <KMath.h>

Collaboration diagram for KMath:
Collaboration graph

Static Public Member Functions

static Vect PointerCastToY (Camera *cam, float targetY)
 
static float Clamp (float val, float min, float max)
 Clamps a float to an interval.
 
static Vect ClampPointToAABB (const Vect &point, const Vect &aabbMin, const Vect &aabbMax)
 Clamps a point to be within an AABB.
 
static bool IntervalOverlap (float aMin, float aMax, float bMin, float bMax)
 Overlap test two float intervals.
 
static bool Intersect (const CollisionVolume &A, const CollisionVolume &B)
 Intersection test two CollisionVolume.
 
static bool Intersect (const BSphere &A, const BSphere &B)
 Intersection test two BSphere.
 
static bool Intersect (const BSphere &bsphere, const Vect &point)
 Intersection test BSphere with Point in space.
 
static bool Intersect (const AABB &A, const AABB &B)
 Intersection test two AABB.
 
static bool Intersect (const AABB &aabb, const BSphere &bsphere)
 Intersection test AABB with BSphere.
 
static float Lerp (float from, float to, float t)
 Lerp between two floats by t.
 
static float CubicPerlin1D (unsigned int seed, int repeat, float t)
 Generates continuous noise and returns the value at t.
 

Member Function Documentation

◆ Clamp()

float KMath::Clamp ( float  val,
float  min,
float  max 
)
static

Clamps a float to an interval.

Haru, 4/12/2023.

Parameters
valValue to clamp.
maxMaximum value of interval to clamp to.
minMinimum value of interval to clamp to.
Returns
The closest value to val within the interval [min,max].

◆ ClampPointToAABB()

Vect KMath::ClampPointToAABB ( const Vect &  point,
const Vect &  aabbMin,
const Vect &  aabbMax 
)
static

Clamps a point to be within an AABB.

Haru, 4/12/2023.

Parameters
pointPoint to clamp.
aabbMaxMaximum point of AABB to clamp to.
aabbMinMinimum point of AABB to clamp to.
Returns
The closest point to point within the AABB defined by aabbMin and aabbMax.

◆ CubicPerlin1D()

float KMath::CubicPerlin1D ( unsigned int  seed,
int  repeat,
float  t 
)
static

Generates continuous noise and returns the value at t.

Haru, 3/19/2023.

Parameters
seedThe seed.
repeatHow long before it repeats.
tT value.
Returns
A float.

◆ Intersect() [1/5]

bool KMath::Intersect ( const AABB A,
const AABB B 
)
static

Intersection test two AABB.

Haru, 4/12/2023.

Parameters
AAn AABB to process.
BAn AABB to process.
Returns
True if they intersect, false not.

◆ Intersect() [2/5]

bool KMath::Intersect ( const AABB aabb,
const BSphere bsphere 
)
static

Intersection test AABB with BSphere.

Haru, 4/12/2023.

Parameters
aabbAn AABB to process.
bsphereA BSphere to process.
Returns
True if they intersect, false not.

◆ Intersect() [3/5]

bool KMath::Intersect ( const BSphere A,
const BSphere B 
)
static

Intersection test two BSphere.

Haru, 4/12/2023.

Parameters
AA BSphere to process.
BA BSphere to process.
Returns
True if they intersect, false not.

◆ Intersect() [4/5]

bool KMath::Intersect ( const BSphere bsphere,
const Vect &  point 
)
static

Intersection test BSphere with Point in space.

Haru, 4/12/2023.

Parameters
bsphereThe BSphere to process.
pointThe position of the point to process.
Returns
True if they intersect, false not.

◆ Intersect() [5/5]

bool KMath::Intersect ( const CollisionVolume A,
const CollisionVolume B 
)
static

Intersection test two CollisionVolume.

Haru, 4/12/2023.

Parameters
AAn CollisionVolume to process.
BAn CollisionVolume to process.
Returns
True if they intersect, false not.

◆ IntervalOverlap()

bool KMath::IntervalOverlap ( float  aMin,
float  aMax,
float  bMin,
float  bMax 
)
static

Overlap test two float intervals.

Haru, 3/19/2023.

Parameters
aMinMinimum value of interval A.
aMaxMaximum value of interval A.
bMinMinimum value of interval B.
bMaxMaximum value of interval B.
Returns
True if they overlap, false not.

◆ Lerp()

float KMath::Lerp ( float  from,
float  to,
float  t 
)
static

Lerp between two floats by t.

Haru, 3/19/2023.

Parameters
fromValue from which to interpolate.
toValue to interpolate towards.
tT value for Lerp.
Returns
Interpolated float between from and to by t.

◆ PointerCastToY()

Vect KMath::PointerCastToY ( Camera *  cam,
float  targetY 
)
static

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