module Maths

This is the documentation for Enlighten.

module Maths

Classes

Name

Description

Name

Description

Geo::ConvexHull

A convex hull of a set of points.

Geo::ConvexHullBuilder

Builds ConvexHull objects.

Geo::CovarianceMatrix

A covariance matrix.

Geo::CovarianceMatrixBuilder

Used for building CovarianceMatrix.

Geo::DebugLine

A line between two points.

Geo::Geo2DTransform

A class representing a 2d linear transform between UVs.

Geo::GeoBlueNoise

class GeoBlueNoise Adapted from: Bridson, Robert, "Fast Poisson Sampling in Arbitrary Dimensions", ACM SIGGRAPH 2007 sketches

Geo::GeoBlueNoiseDiskPalette

Builds a pallet of blue noise samples, each in a disk of radius 1.

Geo::GeoBlueNoiseRayPalette

class GeoBlueNoiseRayPalette

Geo::GeoBoundingBox

This class represents an axis aligned bounding box.

Geo::GeoBoundingSphere

This class represents a bounding sphere.

Geo::GeoIntRange

Represents a range of integers, e.g. between 10 and 20.

Geo::GeoPoint2

Single precision 2 dimensional point class.

Geo::GeoPoint2D

Integer 2 dimensional point class.

Geo::GeoPoint3

Single precision 3 dimensional point class.

Geo::GeoPoint3D

Integer 3 dimensional point class.

Geo::GeoVector3

Single precision 3 dimensional vector class.

Geo::GeoVector4

Single precision 4 dimensional vector class.

Geo::GoodRNG

A Mersenne Twister RNG.

Geo::Matrix4x4

Single-precision 4x4 matrix class.

Geo::SimpleRNG

The 'super-duper' random number generator with shuffle (an LCG).

Geo::Statistics

Result structure used for comparing input lighting buffers.

Geo::VectorD

Double precision vector class.

Functions

Name

Description

Name

Description

BloatTriangle(ConvexHull *, Geo::v128, Geo::v128, Geo::v128, float, Geo::s32)

Bloat a triangle by a specified amount.

CalcCubeMapCoordinatesForDirection(Geo::v128, Geo::s32, Geo::s32 &, float &, float &)

Compute the cube map texel coordinate for a given direction and cubemap resolution.

CalcDirectionForCubeMapCoordinate(Geo::s32, Geo::s32, Geo::s32, Geo::s32)

Generate a direction vector for a cubemap texel coordinate.

CalcDirectionForCubeMapTexel(Geo::s32, float, float)

Generate a direction vector for a cubemap texel UV coordinate.

ClosestPointInBox(const Geo::v128 &)

Compute the closest point in the box to p.

CombineStatistics(const Statistics &, const Statistics &)

Combine the values in statsA and statsB so that the properties of each member are retained over the whole set.

ComputeStatistics(Statistics &, const Geo::v128 *, const Geo::v128 *, const Geo::s32, const Geo::v128 &)

Computes the difference between two vector arrays.

ContainsBox(const Geo::GeoBoundingBox &)

Is a box contained by the box?

ContainsPoint(const Geo::v128 &)

Is a point in the box?

ContainsPoint2D(const Geo::v128 &)

Is a point in the box? Only tests xy.

Cross(VectorD, VectorD)

Double precision vector operators.

Dot(VectorD, VectorD)

Double precision vector operators.

EnclosePoint(const v128 &)

Enlarge this bounding box to include the given point.

ExpandBy(const v128 &)

Expands this bounding box by the given amount in each of the three axes (in both directions).

GenerateGuidFromString(const GeoString< char > &)

Convert a string to a GUID by hashing.

GenerateGuidFromString(GeoGuid &, const GeoString< char > &)

Convert a string to a GUID by hashing.

GenerateUnitSquareFastPoissonDistribution(const s32 &, GeoArray< GeoPoint2 > &, const u32 &)

Helper function to generate fast poisson samples in the 2D unit square.

GenerateUnitSquareSobolDistribution(const s32 &, GeoArray< GeoPoint2 > &, const u32 &)

Helper function to generate sobol samples in the 2D unit square.

GeoBoundingBox(const GeoBoundingBox &)

Copy Constructor.

GeoBoundingBox(float, float, float, float, float, float)

Create a bounding box defined by two extreme points.

GeoBoundingBox()

Constructor - makes an empty bounding box.

GeoRectFromCoords(float, float, float, float)

Function to construct a GeoRect from the minimum and maximum X and Y co-ordinates.

GeoRectFromCoordsUnsafe(float, float, float, float)

Function to construct a GeoRect from the minimum and maximum X and Y co-ordinates.

GeoRectFromSize(float, float, float, float)

Function to construct a GeoRect from a minimum X and Y co-ordinate, a width and a height.

GeoRectHeight(GeoRect)

Functions to get various co-ordinates from a rect.

GeoRectMaxX(GeoRect)

Functions to get various co-ordinates from a rect.

GeoRectMaxY(GeoRect)

Functions to get various co-ordinates from a rect.

GeoRectMinX(GeoRect)

Functions to get various co-ordinates from a rect.

GeoRectMinY(GeoRect)

Functions to get various co-ordinates from a rect.

GeoRectWidth(GeoRect)

Functions to get various co-ordinates from a rect.

GetCenter()

Return the center of this bounding box.

GetDistanceFrom(const GeoBoundingBox &)

Distance between two bounding boxes (0 if they intersect)

GetDistanceFrom(const Geo::v128 &)

Compute the closest distance from p.

GetLargestFace()

Return the largest face of this bounding box.

GetLongestSide()

Return the longest side of this bounding box.

GetMax()

Return the maxumum in each axis of this bounding box.

GetMin()

Return the minimum in each axis of this bounding box.

GetShortestSide()

Return the shortest side of this bounding box.

GetSize()

Return the size of this bounding box in each axis.

GetSurfaceArea()

Return the surface area of this bounding box.

GetVolume()

Return the volume of this bounding box.

HashBig(const void *, size_t, u32)

This is the same as HashWord() on big-endian machines.

HashLittle(GeoStringView< char >)

This will create a simple u32 hash from the (case-sensitive) string supplied.

HashLittle(const void *, size_t, u32)

Hash a variable-length key of bytes into a 32-bit value.

HashSHA1(GeoFileStringView)

Hashes the given string using SHA1 and returns a GUID representing the hash.

HashSHA1(const Geo::u8 *, Geo::s32, Geo::u8 *)

Hashes the given array of bytes using SHA1. The outputBytes parameter must have at least HASH_SIZE_SHA1 bytes allocated.

HashSHA1(const Geo::u8 *, Geo::s32)

Hashes the given array of bytes using SHA1 and returns a string representing the hash.

HashWord(const u32 *, size_t, u32)

Produce a hash from a string of Geo::u32 This works on all machines.

IntersectsBoundingBox(const GeoBoundingBox &)

Returns true if the bounding boxes mutually olaps.

IsEmpty()

Returns true if the bbox is empty (ie uninitialised)

Length(VectorD)

Double precision vector operators.

Max(const GeoPoint2D &, const GeoPoint2D &)

Gets the component-wise maximum of two points.

Max(const GeoPoint3D &, const GeoPoint3D &)

Gets the component-wise maximum of two points.

MConstructCubeMapInvViewMatrix(Geo::s32)

Construct the inverse of the view matrix for a specific cubemap face.

MConstructCubeMapViewMatrix(Geo::s32)

Construct a view matrix for a specific cubemap face.

Min(const GeoPoint3D &, const GeoPoint3D &)

Gets the component-wise minimum of two points.

operator-(VectorD, VectorD)

Double precision vector operators.

operator*(double, VectorD)

Double precision vector operators.

operator/(VectorD, VectorD)

Double precision vector operators.

operator[](Geo::u32)

Indexed access to the two extreme points that define this bounding box (index must be 0 or 1).

operator+(const GeoBoundingBox &)

Compute and return the union of this bounding with another.

operator+=(const v128 &)

Enlarge this bounding box to include the given point.

operator+=(const GeoBoundingBox &)

Compute the inplace union of this bounding box and another.

operator<(const GeoPoint3D &, const GeoPoint3D &)

Allow GeoPoint3D to be used as a key for GeoMap.

operator<(const GeoPoint3 &, const GeoPoint3 &)

Allow GeoPoint3 to be used as a key for GeoMap.

operator==(const GeoPoint3 &, const GeoPoint3 &)

Equality operator.

ScaleRect(GeoRect, float)

Function to scale a bounding box.

SetEmpty()

Resets the box to it's default empty state.

TestSamplingDistributions(const char *, const s32 &)

Write out raysets representing the ray distributions for debugging and visualisation.

UniformInteger(RNG &)

Random unsigned 32 bit integer, [0, 0xffffffff] (inclusive)

UniformSignedUnitDouble(RNG &)

Random double, [-1, 1] (inclusive)

UniformSignedUnitFloat(RNG &)

Random float, [-1, 1] (inclusive)

UniformUnitClopenDouble(RNG &)

Random double, [0, 1)

UniformUnitClopenFloat(RNG &)

Random float, [0, 1)

UniformUnitDouble(RNG &)

Random double, [0, 1] (inclusive)

UniformUnitFloat(RNG &)

Random float, [0, 1] (inclusive)

UniformUnitOpenDouble(RNG &)

Random double, (0, 1)

UniformUnitOpenFloat(RNG &)

Random float, (0, 1)

UnionOfRects(GeoRect, GeoRect)

Union of two bounding boxes.

VLeftOf2(const Geo::v128 &, const Geo::v128 &, const Geo::v128 &)

Determines if the point 'c' is to the left of the line formed by joining 'a' and 'b'.

VLength(VectorD)

Double precision vector operators.

VRightOf2(const Geo::v128 &, const Geo::v128 &, const Geo::v128 &)

Determines if the point 'c' is to the right of the line formed by joining 'a' and 'b'.

VScaleAndAdd(const Geo::v128 &, float, const Geo::v128 &, float)

Calculates a * s + b * t.

VSignedArea2(const Geo::v128 &, const Geo::v128 &, const Geo::v128 &)

Calculates the signed area of the given triangle in 2D space (z-coordinates ignored)

VSlerp2(const Geo::v128 &, const Geo::v128 &, float)

Spherical linear interpolation between 'a' and 'b', with weight 't'.

Enums

Name

Description

Name

Description

Dimension3

An enumeration of the dimensions of 3D space.

Sign

A sign bit.

Typedefs

Name

Description

Name

Description

v128 GeoRect

A GeoRect is actually just a 4-vector (Geo::v128).

Variables

Name

Description

Name

Description

const Geo::s32 HASH_SIZE_SHA1 = 20

The size of an SHA-1 hash.



Geo::s32 Geo::BloatTriangle


public: Geo::s32 BloatTriangle
(
    ConvexHull * out,
    Geo::v128 a,
    Geo::v128 b,
    Geo::v128 c,
    float bloat,
    Geo::s32 cornerSmoothness
)


Bloat a triangle by a specified amount.

You can specify how refined you want the rounded corners to be, or 0 if you just want a single join point in the centre. The number correlates to how many segments the widest corner will have (and will scale from there). As this is a reasonably quick function, you should pass in a convex hull with the appropriate number of points allocated to it.

Returns

The number of points used, or -1 if there wasn't enough space.

Note

Passing NULL for outIS VALID


: this will return the number of points the final result will use.

Winding order is irrelevant: it is corrected internally.

 



void GEO_CALL Geo::CalcCubeMapCoordinatesForDirection


public: void GEO_CALL CalcCubeMapCoordinatesForDirection
(
    Geo::v128 direction,
    Geo::s32 faceWidth,
    Geo::s32 & faceIdx,
    float & x,
    float & y
)


Compute the cube map texel coordinate for a given direction and cubemap resolution.

Note

x and y are returned as floats but in texel coordinates rather than normalised UVs.



Geo::v128 GEO_CALL Geo::CalcDirectionForCubeMapCoordinate


public: Geo::v128GEO_CALL CalcDirectionForCubeMapCoordinate
(
    Geo::s32 faceIdx,
    Geo::s32 x,
    Geo::s32 y,
    Geo::s32 faceWidth
)


Generate a direction vector for a cubemap texel coordinate.



Geo::v128 GEO_CALL Geo::CalcDirectionForCubeMapTexel


public: Geo::v128GEO_CALL CalcDirectionForCubeMapTexel(    Geo::s32 faceIdx,    float u,    float v)