TFrame3::ConstrainedAlignPerpAxes

Compute rotation around NormalAxis that best-aligns one of the other two frame axes with either given UpAxis or FallbackAxis (FallbackAxis is required if Dot(NormalAxis,UpAxis) > UpDotTolerance, ie if the Normal and Up directions are too closely aligned. Basically this divides direction-sphere into three regions - polar caps with size defined by UpDotTolerance, and a wide equator band covering the rest. When crossing between these regions the alignment has a discontinuity. It is impossible to avoid this discontinuity because it is impossible to comb a sphere.

References

 Module GeometryCore Header /Engine/Source/Runtime/GeometryCore/Public/FrameTypes.h Include #include "FrameTypes.h"

Syntax

void ConstrainedAlignPerpAxes
(
int PerpAxis1,
int PerpAxis2,
int NormalAxis,
const TVector< RealType > & UpAxis,
const TVector< RealType > & FallbackAxis,
RealType UpDotTolerance
)

Remarks

Compute rotation around NormalAxis that best-aligns one of the other two frame axes with either given UpAxis or FallbackAxis (FallbackAxis is required if Dot(NormalAxis,UpAxis) > UpDotTolerance, ie if the Normal and Up directions are too closely aligned. Basically this divides direction-sphere into three regions - polar caps with size defined by UpDotTolerance, and a wide equator band covering the rest. When crossing between these regions the alignment has a discontinuity. It is impossible to avoid this discontinuity because it is impossible to comb a sphere.

Parameters

Parameter

Description

PerpAxis1

Index of first axis orthogonal to NormalAxis

PerpAxis2

Index of second axis orthogonal to NormalAxis

NormalAxis

Axis of frame to rotate around

UpAxis

Target axis in equator region, defaults to UnitZ

FallbackAxis

Target axis in polar region, defaults to UnitX

UpDotTolerance

defaults to cos(45), ie flip between regions happens roughly half way to poles