 # FMath

## Structure for all math helper functions, inherits from platform math to pick up platform-specific implementations Check GenericPlatformMath.h for additional math functions

Inheritance Hierarchy

Base

TUnrealPlatformMathSSEBase

TUnrealPlatformMathSSE4Base

FMicrosoftPlatformMathBase FMath

References

Syntax

struct FMath : public FMicrosoftPlatformMathBase

Remarks

Structure for all math helper functions, inherits from platform math to pick up platform-specific implementations Check GenericPlatformMath.h for additional math functions

Functions

Name Description

void

ApplyScaleToFloat

(
float& Dst,
const FVector& DeltaScale,
float Magnitude
)

Handy to apply scaling in the editor

FQuat

BiLerp

(
const FQuat& P00,
const FQuat& P10,
const FQuat& P01,
const FQuat& P11,
float FracX,
float FracY
)

Performs a linear interpolation between two values, Alpha ranges from 0-1

T

BiLerp

(
const T& P00,
const T& P10,
const T& P01,
const T& P11,
const U& FracX,
const U& FracY
)

Performs a 2D linear interpolation between four values values, FracX, FracY ranges from 0-1

void

CartesianToPolar

(
const float X,
const float Y,
float& OutAng
)

Converts given Cartesian coordinate pair to Polar coordinate system.

void

CartesianToPolar

(
const FVector2D InCart,
FVector2D& OutPolar
)

Converts given Cartesian coordinate pair to Polar coordinate system.

FLinearColor

CInterpTo

(
const FLinearColor& Current,
const FLinearColor& Target,
float DeltaTime,
float InterpSpeed
)

Interpolate Linear Color from Current to Target.

T

Clamp

(
const T X,
const T Min,
const T Max
)

Clamps X to be between Min and Max, inclusive

float

ClampAngle

(
float AngleDegrees,
float MinAngleDegrees,
float MaxAngleDegrees
)

Clamps an arbitrary angle to be between the given angles. Will clamp to nearest boundary.

FVector

ClosestPointOnInfiniteLine

(
const FVector& LineStart,
const FVector& LineEnd,
const FVector& Point
)

Find the point on the infinite line between two points (LineStart, LineEnd) which is closest to Point

FVector

ClosestPointOnLine

(
const FVector& LineStart,
const FVector& LineEnd,
const FVector& Point
)

Find the point on the line segment from LineStart to LineEnd which is closest to Point

FVector

ClosestPointOnSegment

(
const FVector& Point,
const FVector& StartPoint,
const FVector& EndPoint
)

Returns closest point on a segment to a given point.

FVector2D

ClosestPointOnSegment2D

(
const FVector2D& Point,
const FVector2D& StartPoint,
const FVector2D& EndPoint
)

FVector2D version of ClosestPointOnSegment.

FVector

ClosestPointOnTetrahedronToPoint

(
const FVector& Point,
const FVector& A,
const FVector& B,
const FVector& C,
const FVector& D
)

Returns closest point on a tetrahedron to a point.

FVector

ClosestPointOnTriangleToPoint

(
const FVector& Point,
const FVector& A,
const FVector& B,
const FVector& C
)

Returns closest point on a triangle to a point.

FVector

ComputeBaryCentric2D

(
const FVector& Point,
const FVector& A,
const FVector& B,
const FVector& C
)

Computes the barycentric coordinates for a given point in a triangle

FVector4

ComputeBaryCentric3D

(
const FVector& Point,
const FVector& A,
const FVector& B,
const FVector& C,
const FVector& D
)

Computes the barycentric coordinates for a given point on a tetrahedron (3D)

FSphere

ComputeBoundingSphereForCone

(
FVector const& ConeOrigin,
FVector const& ConeDirection,
float CosConeAngle,
float SinConeAngle
)

Computes minimal bounding sphere encompassing given cone

uint32

ComputeProjectedSphereScissorRect

(
FIntRect& InOutScissorRect,
FVector SphereOrigin,
FVector ViewOrigin,
const FMatrix& ViewMatrix,
const FMatrix& ProjMatrix
)

InOutScissorRect should be set to View.ViewRect before the call

U

CubicCRSplineInterp

(
const U& P0,
const U& P1,
const U& P2,
const U& P3,
const float T0,
const float T1,
const float T2,
const float T3,
const float T
)

Cubic Catmull-Rom Spline interpolation.

U

CubicCRSplineInterpSafe

(
const U& P0,
const U& P1,
const U& P2,
const U& P3,
const float T0,
const float T1,
const float T2,
const float T3,
const float T
)

Same as CubicCRSplineInterp but with additional saftey checks. If the checks fail P1 is returned.

T

CubicInterp

(
const T& P0,
const T& T0,
const T& P1,
const T& T1,
const U& A
)

Performs a cubic interpolation

FQuat

CubicInterp

(
const FQuat& P0,
const FQuat& T0,
const FQuat& P1,
const FQuat& T1,
const U& A
)

In the case of quaternions, we use a bezier like approach. T - Actual 'control' orientations.

T

CubicInterpDerivative

(
const T& P0,
const T& T0,
const T& P1,
const T& T1,
const U& A
)

Performs a first derivative cubic interpolation

T

CubicInterpSecondDerivative

(
const T& P0,
const T& T0,
const T& P1,
const T& T1,
const U& A
)

Performs a second derivative cubic interpolation

auto

(
T const& DegVal
)

T

DivideAndRoundDown

(
T Dividend,
T Divisor
)

Divides two integers and rounds down

T

DivideAndRoundNearest

(
T Dividend,
T Divisor
)

Divides two integers and rounds to nearest

T

DivideAndRoundUp

(
T Dividend,
T Divisor
)

Divides two integers and rounds up

float

DynamicWeightedMovingAverage

(
float CurrentSample,
float PreviousSample,
float MaxDistance,
float MinWeight,
float MaxWeight
)

Calculates the new value in a weighted moving average series using the previous value and a weight range.

bool

Eval

(
FString Str,
float& OutValue
)

Evaluates a numerical equation.

bool

ExtractBoolFromBitfield

(
uint8* Ptr,
uint32 Index
)

Get a bit in memory created from bitflags (uint32 Value:1), used for EngineShowFlags, TestBitFieldFunctions() tests the implementation

float

FastAsin

(
float Value
)

Computes the ASin of a scalar value.

float

FindDeltaAngleDegrees

(
float A1,
float A2
)

Find the smallest angle between two headings (in degrees)

float

(
float A1,
float A2
)

float

FInterpConstantTo

(
float Current,
float Target,
float DeltaTime,
float InterpSpeed
)

Interpolate float from Current to Target with constant step

float

FInterpTo

(
float Current,
float Target,
float DeltaTime,
float InterpSpeed
)

Interpolate float from Current to Target.

float

FixedTurn

(
float InCurrent,
float InDesired,
float InDeltaRate
)

Returns a new rotation component value

IntegralType

Floor

(
IntegralType I
)

Converts an integral type to a nearest less or equal integer.

float

Floor

(
float F
)

Converts a float to a nearest less or equal integer.

double

Floor

(
double F
)

Converts a double to a nearest less or equal integer.

FString

(
int32 Val
)

Formats an integer value into a human readable string (i.e. 12345 becomes "12,345")

float

FRandRange

(
float InMin,
float InMax
)

Util to generate a random number in a range.

FVector2D

GetAzimuthAndElevation

(
const FVector& Direction,
const FVector& AxisX,
const FVector& AxisY,
const FVector& AxisZ
)

Returns Azimuth and Elevation of vector 'Direction' in coordinate system O(AxisX,AxisY,AxisZ).

FVector

GetBaryCentric2D

(
const FVector& Point,
const FVector& A,
const FVector& B,
const FVector& C
)

Computes the barycentric coordinates for a given point in a triangle - simpler version

bool

GetDistanceWithinConeSegment

(
FVector Point,
FVector ConeStartPoint,
FVector ConeLine,
float& PercentageOut
)

Calculates whether a Point is within a cone segment, and also what percentage within the cone (100% is along the center line, whereas 0% is along the edge)

bool

GetDotDistance

(
FVector2D& OutDotDist,
const FVector& Direction,
const FVector& AxisX,
const FVector& AxisY,
const FVector& AxisZ
)

Calculates the dotted distance of vector 'Direction' to coordinate system O(AxisX,AxisY,AxisZ).

T

GetMappedRangeValueClamped

(
const TRange< T >& InputRange,
const TRange< T >& OutputRange,
const T Value
)

float

GetMappedRangeValueClamped

(
const FVector2D& InputRange,
const FVector2D& OutputRange,
const float Value
)

For the given Value clamped to the [Input:Range] inclusive, returns the corresponding percentage in [Output:Range] Inclusive.

float

GetMappedRangeValueUnclamped

(
const FVector2D& InputRange,
const FVector2D& OutputRange,
const float Value
)

Transform the given Value relative to the input range to the Output Range.

TEnableIf< T...

GetRangePct

(
T MinValue,
T MaxValue,
T Value
)

Calculates the percentage along a line from MinValue to MaxValue that Value is.

double

GetRangePct

(
TRange< T > const& Range,
T Value
)

float

GetRangePct

(
FVector2D const& Range,
float Value
)

Same as above, but taking a 2d vector as the range.

T

GetRangeValue

(
TRange< T > const& Range,
T Pct
)

float

GetRangeValue

(
FVector2D const& Range,
float Pct
)

Basically a Vector2d version of Lerp.

FVector

GetReflectionVector

(
const FVector& Direction,
const FVector& SurfaceNormal
)

Given a direction vector and a surface normal, returns the vector reflected across the surface normal.

float

GetTForSegmentPlaneIntersect

(
const FVector& StartPoint,
const FVector& EndPoint,
const FPlane& Plane
)

Returns the time (t) of the intersection of the passed segment and a plane (could be <0 or >1)

int32

GreatestCommonDivisor

(
int32 a,
int32 b
)

Use the Euclidean method to find the GCD.

T

GridSnap

(
T Location,
T Grid
)

Snaps a value to the nearest grid multiple

T

InterpCircularIn

(
const T& A,
const T& B,
float Alpha
)

Interpolation between A and B, applying a circular in function.

T

InterpCircularInOut

(
const T& A,
const T& B,
float Alpha
)

Interpolation between A and B, applying a circular in/out function.

T

InterpCircularOut

(
const T& A,
const T& B,
float Alpha
)

Interpolation between A and B, applying a circular out function.

T

InterpEaseIn

(
const T& A,
const T& B,
float Alpha,
float Exp
)

Interpolate between A and B, applying an ease in function. Exp controls the degree of the curve.

T

InterpEaseInOut

(
const T& A,
const T& B,
float Alpha,
float Exp
)

Interpolate between A and B, applying an ease in/out function.

T

InterpEaseOut

(
const T& A,
const T& B,
float Alpha,
float Exp
)

Interpolate between A and B, applying an ease out function. Exp controls the degree of the curve.

T

InterpExpoIn

(
const T& A,
const T& B,
float Alpha
)

Interpolation between A and B, applying an exponential in function.

T

InterpExpoInOut

(
const T& A,
const T& B,
float Alpha
)

Interpolation between A and B, applying an exponential in/out function.

T

InterpExpoOut

(
const T& A,
const T& B,
float Alpha
)

Interpolation between A and B, applying an exponential out function.

T

InterpSinIn

(
const T& A,
const T& B,
float Alpha
)

Interpolation between A and B, applying a sinusoidal in function.

T

InterpSinInOut

(
const T& A,
const T& B,
float Alpha
)

Interpolation between A and B, applying a sinusoidal in/out function.

T

InterpSinOut

(
const T& A,
const T& B,
float Alpha
)

Interpolation between A and B, applying a sinusoidal out function.

T

InterpStep

(
const T& A,
const T& B,
float Alpha,
int32 Steps
)

Interpolation between A and B, applying a step function.

bool

IntersectPlanes2

(
FVector& I,
FVector& D,
const FPlane& P1,
const FPlane& P2
)

Compute intersection point and direction of line joining two planes.

bool

IntersectPlanes3

(
FVector& I,
const FPlane& P1,
const FPlane& P2,
const FPlane& P3
)

Compute intersection point of three planes. Return 1 if valid, 0 if infinite.

bool

IsNearlyEqual

(
float A,
float B,
float ErrorTolerance
)

Checks if two floating point numbers are nearly equal.

bool

IsNearlyEqual

(
double A,
double B,
double ErrorTolerance
)

Checks if two floating point numbers are nearly equal.

bool

IsNearlyEqualByULP

(
float A,
float B,
int32 MaxUlps
)

Check if two floating point numbers are nearly equal to within specific number of units of last place (ULP).

bool

IsNearlyEqualByULP

(
double A,
double B,
int32 MaxUlps
)

Check if two floating point numbers are nearly equal to within specific number of units of last place (ULP).

bool

IsNearlyZero

(
float Value,
float ErrorTolerance
)

Checks if a floating point number is nearly zero.

bool

IsNearlyZero

(
double Value,
double ErrorTolerance
)

Checks if a floating point number is nearly zero.

bool

IsPowerOfTwo

(
T Value
)

Checks whether a number is a power of two.

bool

IsWithin

(
const U& TestValue,
const U& MinValue,
const U& MaxValue
)

Checks if value is within a range, exclusive on MaxValue)

bool

IsWithinInclusive

(
const U& TestValue,
const U& MinValue,
const U& MaxValue
)

Checks if value is within a range, inclusive on MaxValue)

int32

LeastCommonMultiplier

(
int32 a,
int32 b
)

LCM = a/gcd * b a and b are the number we want to find the lcm

T

Lerp

(
const T& A,
const T& B,
const U& Alpha
)

Performs a linear interpolation between two values, Alpha ranges from 0-1

FRotator

Lerp

(
const FRotator& A,
const FRotator& B,
const U& Alpha
)

Rotator specific interpolation.

FQuat

Lerp

(
const FQuat& A,
const FQuat& B,
const U& Alpha
)

FMath inline functions

VectorRegist...

Lerp

(
const VectorRegister& A,
const VectorRegister& B,
const VectorRegister& Alpha
)

Specialization of Lerp template that works with vector registers.

FRotator

LerpRange

(
const FRotator& A,
const FRotator& B,
const U& Alpha
)

Performs a linear interpolation between two values, Alpha ranges from 0-1

T

LerpStable

(
const T& A,
const T& B,
float Alpha
)

Performs a linear interpolation between two values, Alpha ranges from 0-1.

T

LerpStable

(
const T& A,
const T& B,
double Alpha
)

Performs a linear interpolation between two values, Alpha ranges from 0-1.

bool

LineBoxIntersection

(
const FBox& Box,
const FVector& Start,
const FVector& End,
const FVector& Direction,
const FVector& OneOverDirection
)

Determines whether a line intersects a box.

bool

LineBoxIntersection

(
const FBox& Box,
const FVector& Start,
const FVector& End,
const FVector& Direction
)

Determines whether a line intersects a box.

bool

LineExtentBoxIntersection

(
const FBox& inBox,
const FVector& Start,
const FVector& End,
const FVector& Extent,
FVector& HitLocation,
FVector& HitNormal,
float& HitTime
)

Swept-Box vs Box test

FVector

LinePlaneIntersection

(
const FVector& Point1,
const FVector& Point2,
const FVector& PlaneOrigin,
const FVector& PlaneNormal
)

Find the intersection of a line and an offset plane.

FVector

LinePlaneIntersection

(
const FVector& Point1,
const FVector& Point2,
const FPlane& Plane
)

Find the intersection of a line and a plane.

bool

LineSphereIntersection

(
const FVector& Start,
const FVector& Dir,
float Length,
const FVector& Origin,
)

Determines whether a line intersects a sphere.

float

Log2

(
float Value
)

Computes the base 2 logarithm of the specified value

float

MakePulsatingValue

(
const double InCurrentTime,
const float InPulsesPerSecond,
const float InPhase
)

Simple function to create a pulsating scalar value

T

Max3

(
const T A,
const T B,
const T C
)

Returns highest of 3 values

bool

MemoryTest

(
uint32 NumBytes
)

Tests a memory region to see that it's working properly.

T

Min3

(
const T A,
const T B,
const T C
)

Returns lowest of 3 values

float

PerlinNoise1D

(
float Value
)

Generates a 1D Perlin noise from the given value.

float

PerlinNoise2D

(
const FVector2D& Location
)

Generates a 1D Perlin noise sample at the given location.

float

PerlinNoise3D

(
const FVector& Location
)

Generates a 3D Perlin noise sample at the given location.

bool

PlaneAABBIntersection

(
const FPlane& P,
const FBox& AABB
)

Determine if a plane and an AABB intersect

int32

PlaneAABBRelativePosition

(
const FPlane& P,
const FBox& AABB
)

Determine the position of an AABB relative to a plane: completely above (in the direction of the normal of the plane), completely below or intersects it

bool

PointBoxIntersection

(
const FVector& Point,
const FBox& Box
)

Determines whether a point is inside a box.

float

PointDistToLine

(
const FVector& Point,
const FVector& Direction,
const FVector& Origin,
FVector& OutClosestPoint
)

Calculates the distance of a given Point in world space to a given line, defined by the vector couple (Origin, Direction).

float

PointDistToLine

(
const FVector& Point,
const FVector& Direction,
const FVector& Origin
)

Calculates the distance of a given Point in world space to a given line, defined by the vector couple (Origin, Direction).

float

PointDistToSegment

(
const FVector& Point,
const FVector& StartPoint,
const FVector& EndPoint
)

Returns distance from a point to the closest point on a segment.

float

PointDistToSegmentSquared

(
const FVector& Point,
const FVector& StartPoint,
const FVector& EndPoint
)

Returns square of the distance from a point to the closest point on a segment.

bool

PointsAreCoplanar

(
const TArray< FVector >& Points,
const float Tolerance
)

Determines whether a given set of points are coplanar, with a tolerance.

void

PolarToCartesian

(
const float Ang,
float& OutX,
float& OutY
)

Converts given Polar coordinate pair to Cartesian coordinate system.

void

PolarToCartesian

(
const FVector2D InPolar,
FVector2D& OutCart
)

Converts given Polar coordinate pair to Cartesian coordinate system.

FQuat

QInterpConstantTo

(
const FQuat& Current,
const FQuat& Target,
float DeltaTime,
float InterpSpeed
)

Interpolate quaternion from Current to Target with constant step (in radians)

FQuat

QInterpTo

(
const FQuat& Current,
const FQuat& Target,
float DeltaTime,
float InterpSpeed
)

Interpolate quaternion from Current to Target.

uint8

Quantize8SignedByte

(
float x
)

uint8

Quantize8UnsignedByte

(
float x
)

auto

(
)

bool

RandBool()

Util to generate a random boolean.

int32

RandHelper

(
int32 A
)

Helper function for rand implementations. Returns a random number in [0..A)

int64

RandHelper64

(
int64 A
)

FVector

RandPointInBox

(
const FBox& Box
)

Returns a random point within the passed in bounding box

FVector2D

RandPointInCircle

(
)

Returns a random point, uniformly distributed, within the specified radius

float

RandRange

(
float InMin,
float InMax
)

Util to generate a random number in a range.

int64

RandRange

(
int64 Min,
int64 Max
)

int32

RandRange

(
int32 Min,
int32 Max
)

Helper function for rand implementations. Returns a random number >= Min and <= Max

FVector

RayPlaneIntersection

(
const FVector& RayOrigin,
const FVector& RayDirection,
const FPlane& Plane
)

Find the intersection of a ray and a plane.

FRotator

RInterpConstantTo

(
const FRotator& Current,
const FRotator& Target,
float DeltaTime,
float InterpSpeed
)

Interpolate rotator from Current to Target with constant step

FRotator

RInterpTo

(
const FRotator& Current,
const FRotator& Target,
float DeltaTime,
float InterpSpeed
)

Interpolate rotator from Current to Target.

double

RoundFromZero

(
double F
)

float

RoundFromZero

(
float F
)

Converts a floating point number to an integer which is further from zero, "larger" in absolute value: 0.1 becomes 1, -0.1 becomes -1

double

RoundHalfFromZero

(
double F
)

Converts a floating point number to the nearest integer, equidistant ties go to the value which is further from zero: -0.5 becomes -1.0, 0.5 becomes 1.0

float

RoundHalfFromZero

(
float F
)

Converts a floating point number to the nearest integer, equidistant ties go to the value which is further from zero: -0.5 becomes -1.0, 0.5 becomes 1.0

double

RoundHalfToEven

(
double F
)

Converts a floating point number to the nearest integer, equidistant ties go to the value which is closest to an even value: 1.5 becomes 2, 0.5 becomes 0

float

RoundHalfToEven

(
float F
)

Converts a floating point number to the nearest integer, equidistant ties go to the value which is closest to an even value: 1.5 becomes 2, 0.5 becomes 0

float

RoundHalfToZero

(
float F
)

Converts a floating point number to the nearest integer, equidistant ties go to the value which is closer to zero: -0.5 becomes 0, 0.5 becomes 0

double

RoundHalfToZero

(
double F
)

Converts a floating point number to the nearest integer, equidistant ties go to the value which is closer to zero: -0.5 becomes 0, 0.5 becomes 0

float

RoundToNegativeInfinity

(
float F
)

Converts a floating point number to an integer which is more negative: 0.1 becomes 0, -0.1 becomes -1

double

RoundToNegativeInfinity

(
double F
)

float

RoundToPositiveInfinity

(
float F
)

Converts a floating point number to an integer which is more positive: 0.1 becomes 1, -0.1 becomes 0

double

RoundToPositiveInfinity

(
double F
)

float

RoundToZero

(
float F
)

Converts a floating point number to an integer which is closer to zero, "smaller" in absolute value: 0.1 becomes 0, -0.1 becomes 0

double

RoundToZero

(
double F
)

void

SegmentDistToSegment

(
FVector A1,
FVector B1,
FVector A2,
FVector B2,
FVector& OutP1,
FVector& OutP2
)

Find closest points between 2 segments.

void

SegmentDistToSegmentSafe

(
FVector A1,
FVector B1,
FVector A2,
FVector B2,
FVector& OutP1,
FVector& OutP2
)

Find closest points between 2 segments.

bool

SegmentIntersection2D

(
const FVector& SegmentStartA,
const FVector& SegmentEndA,
const FVector& SegmentStartB,
const FVector& SegmentEndB,
FVector& out_IntersectionPoint
)

Returns true if there is an intersection between the segment specified by SegmentStartA and SegmentEndA, and the segment specified by SegmentStartB and SegmentEndB, in 2D space.

bool

SegmentPlaneIntersection

(
const FVector& StartPoint,
const FVector& EndPoint,
const FPlane& Plane,
FVector& out_IntersectionPoint
)

Returns true if there is an intersection between the segment specified by StartPoint and Endpoint, and the plane on which polygon Plane lies.

bool

SegmentTriangleIntersection

(
const FVector& StartPoint,
const FVector& EndPoint,
const FVector& A,
const FVector& B,
const FVector& C,
FVector& OutIntersectPoint,
FVector& OutTriangleNormal
)

Returns true if there is an intersection between the segment specified by StartPoint and Endpoint, and the Triangle defined by A, B and C.

void

SetBoolInBitField

(
uint8* Ptr,
uint32 Index,
bool bSet
)

Set a bit in memory created from bitflags (uint32 Value:1), used for EngineShowFlags, TestBitFieldFunctions() tests the implementation

void

SinCos

(
float* ScalarSin,
float* ScalarCos,
float Value
)

Computes the sine and cosine of a scalar value.

float

SmoothStep

(
float A,
float B,
float X
)

Returns a smooth Hermite interpolation between 0 and 1 for the value X (where X ranges between A and B) Clamped to 0 for X <= A and 1 for X >= B.

bool

SphereAABBIntersection

(
const FVector& SphereCenter,
const FBox& AABB
)

Performs a sphere vs box intersection test using Arvo's algorithm:

bool

SphereAABBIntersection

(
const FSphere& Sphere,
const FBox& AABB
)

Converts a sphere into a point plus radius squared for the test above

bool

SphereConeIntersection

(
const FVector& SphereCenter,
const FVector& ConeAxis,
float ConeAngleSin,
float ConeAngleCos
)

Assumes the cone tip is at 0,0,0 (means the SphereCenter is relative to the cone tip)

void

SphereDistToLine

(
FVector SphereOrigin,
FVector LineOrigin,
FVector LineDir,
FVector& OutClosestPoint
)

Find closest point on a Sphere to a Line.

T

Square

(
const T A
)

Multiples value by itself

double

TruncateToHalfIfClose

(
double F,
double Tolerance
)

Truncates a floating point number to half if closer than the given tolerance.

float

TruncateToHalfIfClose

(
float F,
float Tolerance
)

Truncates a floating point number to half if closer than the given tolerance.

float

UnwindDegrees

(
float A
)

Utility to ensure angle is between +/- 180 degrees by unwinding.

float

(
float A
)

Given a heading which may be outside the +/- PI range, 'unwind' it back into that range.

FVector2D

Vector2DInterpConstantTo

(
const FVector2D& Current,
const FVector2D& Target,
float DeltaTime,
float InterpSpeed
)

Interpolate vector2D from Current to Target with constant step

FVector2D

Vector2DInterpTo

(
const FVector2D& Current,
const FVector2D& Target,
float DeltaTime,
float InterpSpeed
)

Interpolate vector2D from Current to Target.

FVector

VInterpConstantTo

(
const FVector& Current,
const FVector& Target,
float DeltaTime,
float InterpSpeed
)

Interpolate vector from Current to Target with constant step

FVector

VInterpNormalRotationTo

(
const FVector& Current,
const FVector& Target,
float DeltaTime,
float RotationSpeedDegrees
)

Interpolate a normal vector Current to Target, by interpolating the angle between those vectors with constant step.

FVector

VInterpTo

(
const FVector& Current,
const FVector& Target,
float DeltaTime,
float InterpSpeed
)

Interpolate vector from Current to Target.

FVector

VRand()

Return a uniformly distributed random unit length vector = point on the unit sphere surface.

FVector

VRandCone

(
FVector const& Dir,
)

This is a version of VRandCone that handles "squished" cones, i.e. with different angle limits in the Y and Z axes.

FVector

VRandCone

(
FVector const& Dir,
)

Returns a random unit vector, uniformly distributed, within the specified cone ConeHalfAngleRad is the half-angle of cone, in radians.

float

WeightedMovingAverage

(
float CurrentSample,
float PreviousSample,
float Weight
)

Calculates the new value in a weighted moving average series using the previous value and the weight

void

WindRelativeAnglesDegrees

(
float InAngle0,
float& InOutAngle1
)

Given two angles in degrees, 'wind' the rotation in Angle1 so that it avoids >180 degree flips.

T

Wrap

(
const T X,
const T Min,
const T Max
)

Wraps X to be between Min and Max, inclusive

Constants

Name

Description

BitFlag

32 bit values where BitFlag[x] == (1<

Deprecated Functions

Name Description

float

FindDeltaAngle

(
float A1,
float A2
)