API Documentation
Static Public Member Functions | List of all members
nkAstraeus::GeometryLib Class Referencefinal

Shader program helping sources for general geometry concepts. More...

Static Public Member Functions

static nkMemory::StringView nkGetSphereIntersection ()
 
static nkMemory::StringView nkSphericalToDirection ()
 
static nkMemory::StringView nkDirectionToUv ()
 
static nkMemory::StringView nkUvToDirection ()
 

Detailed Description

Shader program helping sources for general geometry concepts.

Member Function Documentation

◆ nkGetSphereIntersection()

static nkMemory::StringView nkAstraeus::GeometryLib::nkGetSphereIntersection ( )
static
float nkGetSphereIntersection (nkFloat3 o, nkFloat3 d, float radius) ;

Provides with a sphere ray intersection algorithm.

Parameter Description
o The ray's origin position, relative to the sphere's center.
d The normalized ray's direction.
radius The sphere radius.
Returns
The distance at which the intersection happens, positive if forward, negative if behind. If no intersection is found, then -1.

The returned distance r allows to reconstruct the intersection position as such : p = r * d + o.

Returns
The source for the method described.

◆ nkSphericalToDirection()

static nkMemory::StringView nkAstraeus::GeometryLib::nkSphericalToDirection ( )
static
nkFloat3 nkSphericalToDirection (float theta, float phi) ;

Converts spherical coordinates into a cartesian 3D direction.

Parameter Description
theta The theta angle of the input coordinates.
phi The phi angle of the input coordinates.
Returns
The corresponding 3D direction.
Returns
The source for the method described.

◆ nkDirectionToUv()

static nkMemory::StringView nkAstraeus::GeometryLib::nkDirectionToUv ( )
static
nkFloat2 nkDirectionToUv (nkFloat3 direction) ;

Converts a world direction into a texture UV, by mapping it like a sphere.

Parameter Description
direction The direction to convert.
Returns
The corresponding texture UV, in [0, 1].
Returns
The source for the method described.

◆ nkUvToDirection()

static nkMemory::StringView nkAstraeus::GeometryLib::nkUvToDirection ( )
static
nkFloat3 nkUvToDirection (nkFloat2 uv) ;

Converts a texture UV within [0, 1] to a world direction, by mapping it to a sphere.

Parameter Description
uv The UV to convert.
Returns
The corresponding normalized direction.
Returns
The source for the method described.

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