Math
Rect
bool FSlateRotatedRect::IsUnderLocation(const FVector2D& Location) const
{
const FVector2D Offset = Location - TopLeft;
const float Det = FVector2D::CrossProduct(ExtentX, ExtentY);
// Not exhaustively efficient. Could optimize the checks for [0..1] to short circuit faster.
const float S = -FVector2D::CrossProduct(Offset, ExtentX) / Det;
if (FMath::IsWithinInclusive(S, 0.0f, 1.0f))
{
const float T = FVector2D::CrossProduct(Offset, ExtentY) / Det;
return FMath::IsWithinInclusive(T, 0.0f, 1.0f);
}
return false;
}
Last updated