6#include "Math/Vector.h"
7#include "Math/Interval.h"
10
11
27 FVector::FReal ExtentX;
30 FVector::FReal ExtentY;
33 FVector::FReal ExtentZ;
38
39
40
41
44 , AxisX(1.0f, 0.0f, 0.0f)
45 , AxisY(0.0f, 1.0f, 0.0f)
46 , AxisZ(0.0f, 0.0f, 1.0f)
55
56
57
58
59 FORCEINLINE void CalcVertices(FVector* Verts)
const;
62
63
64
65
66 FORCEINLINE FFloatInterval Project(
const FVector& Axis)
const;
71
73FORCEINLINE void FOrientedBox::CalcVertices( FVector* Verts )
const
75 const float Signs[] = { -1.0f, 1.0f };
77 for (int32 i = 0; i < 2; i++)
79 for (int32 j = 0; j < 2; j++)
81 for (int32 k = 0; k < 2; k++)
83 *Verts++ = Center + Signs[i] * AxisX * ExtentX + Signs[j] * AxisY * ExtentY + Signs[k] * AxisZ * ExtentZ;
90FORCEINLINE FFloatInterval FOrientedBox::Project(
const FVector& Axis )
const
92 const FVector::FReal Signs[] = {-1.0f, 1.0f};
95 FVector::FReal ProjectedCenter = Axis | Center;
96 FVector::FReal ProjectedAxisX = Axis | (ExtentX * AxisX);
97 FVector::FReal ProjectedAxisY = Axis | (ExtentY * AxisY);
98 FVector::FReal ProjectedAxisZ = Axis | (ExtentZ * AxisZ);
100 FFloatInterval ProjectionInterval;
102 for (int32 i = 0; i < 2; i++)
104 for (int32 j = 0; j < 2; j++)
106 for (int32 k = 0; k < 2; k++)
109 float ProjectedVertex =
float(ProjectedCenter + Signs[i] * ProjectedAxisX + Signs[j] * ProjectedAxisY + Signs[k] * ProjectedAxisZ);
112 ProjectionInterval.Include(ProjectedVertex);
117 return ProjectionInterval;
120template <>
struct TIsPODType<FOrientedBox> {
enum { Value =
true }; };