Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
UnrealMathUtility.h
Go to the documentation of this file.
1#pragma once
2
3#include "../BasicTypes.h"
4#include "../GenericPlatform/GenericPlatformMath.h"
5
6
7//#define IMPLEMENT_ASSIGNMENT_OPERATOR_MANUALLY
8
9// Assert on non finite numbers. Used to track NaNs.
10#ifndef ENABLE_NAN_DIAGNOSTIC
11#define ENABLE_NAN_DIAGNOSTIC 0
12#endif
13
14/*-----------------------------------------------------------------------------
15 Floating point constants.
16-----------------------------------------------------------------------------*/
17
18#undef PI
19#define PI (3.1415926535897932f)
20#define SMALL_NUMBER (1.e-8f)
21#define KINDA_SMALL_NUMBER (1.e-4f)
22#define BIG_NUMBER (3.4e+38f)
23#define EULERS_NUMBER (2.71828182845904523536f)
24
25// Copied from float.h
26#define MAX_FLT 3.402823466e+38F
27
28// Aux constants.
29#define INV_PI (0.31830988618f)
30#define HALF_PI (1.57079632679f)
31
32// Magic numbers for numerical precision.
33#define DELTA (0.00001f)
34
35/**
36 * Lengths of normalized vectors (These are half their maximum values
37 * to assure that dot products with normalized vectors don't overflow).
38 */
39#define FLOAT_NORMAL_THRESH (0.0001f)
40
41//
42// Magic numbers for numerical precision.
43//
44#define THRESH_POINT_ON_PLANE (0.10f) /* Thickness of plane for front/back/inside test */
45#define THRESH_POINT_ON_SIDE (0.20f) /* Thickness of polygon side's side-plane for point-inside/outside/on side test */
46#define THRESH_POINTS_ARE_SAME (0.00002f) /* Two points are same if within this distance */
47#define THRESH_POINTS_ARE_NEAR (0.015f) /* Two points are near if within this distance and can be combined if imprecise math is ok */
48#define THRESH_NORMALS_ARE_SAME (0.00002f) /* Two normal points are same if within this distance */
49/* Making this too large results in incorrect CSG classification and disaster */
50#define THRESH_VECTORS_ARE_NEAR (0.0004f) /* Two vectors are near if within this distance and can be combined if imprecise math is ok */
51/* Making this too large results in lighting problems due to inaccurate texture coordinates */
52#define THRESH_SPLIT_POLY_WITH_PLANE (0.25f) /* A plane splits a polygon in half */
53#define THRESH_SPLIT_POLY_PRECISELY (0.01f) /* A plane exactly splits a polygon */
54#define THRESH_ZERO_NORM_SQUARED (0.0001f) /* Num of a unit normal that is considered "zero", squared */
55#define THRESH_NORMALS_ARE_PARALLEL (0.999845f) /* Two unit vectors are parallel if abs(A dot B) is greater than or equal to this. This is roughly cosine(1.0 degrees). */
56#define THRESH_NORMALS_ARE_ORTHOGONAL (0.017455f) /* Two unit vectors are orthogonal (perpendicular) if abs(A dot B) is less than or equal this. This is roughly cosine(89.0 degrees). */
57
58#define THRESH_VECTOR_NORMALIZED (0.01f) /** Allowed error for a normalized vector (against squared magnitude) */
59#define THRESH_QUAT_NORMALIZED (0.01f) /** Allowed error for a normalized quaternion (against squared magnitude) */
60
61/*-----------------------------------------------------------------------------
62 Global functions.
63-----------------------------------------------------------------------------*/
64
65/**
66 * Structure for all math helper functions, inherits from platform math to pick up platform-specific implementations
67 * Check GenericPlatformMath.h for additional math functions
68 */
70{
71 // Random Number Functions
72
73 /** Helper function for rand implementations. Returns a random number in [0..A) */
74 static FORCEINLINE int32 RandHelper(int32 A)
75 {
76 // Note that on some platforms RAND_MAX is a large number so we cannot do ((rand()/(RAND_MAX+1)) * A)
77 // or else we may include the upper bound results, which should be excluded.
78 return A > 0 ? Min(TruncToInt(FRand() * A), A - 1) : 0;
79 }
80
81 /** Helper function for rand implementations. Returns a random number >= Min and <= Max */
82 static FORCEINLINE int32 RandRange(int32 Min, int32 Max)
83 {
84 const int32 Range = Max - Min + 1;
85 return Min + RandHelper(Range);
86 }
87
88 /** Util to generate a random number in a range. Overloaded to distinguish from int32 version, where passing a float is typically a mistake. */
89 static FORCEINLINE float RandRange(float InMin, float InMax)
90 {
91 return FRandRange(InMin, InMax);
92 }
93
94 /** Util to generate a random number in a range. */
95 static FORCEINLINE float FRandRange(float InMin, float InMax)
96 {
97 return InMin + (InMax - InMin) * FRand();
98 }
99
100 /** Util to generate a random boolean. */
101 static FORCEINLINE bool RandBool()
102 {
103 return RandRange(0, 1) == 1 ? true : false;
104 }
105
106 /**
107 * Checks whether a number is a power of two.
108 * @param Value Number to check
109 * @return true if Value is a power of two
110 */
111 template <typename T>
112 static FORCEINLINE bool IsPowerOfTwo(T Value)
113 {
114 return ((Value & (Value - 1)) == (T)0);
115 }
116
117
118 // Math Operations
119
120 /** Returns highest of 3 values */
121 template <class T>
122 static FORCEINLINE T Max3(const T A, const T B, const T C)
123 {
124 return Max(Max(A, B), C);
125 }
126
127 /** Returns lowest of 3 values */
128 template <class T>
129 static FORCEINLINE T Min3(const T A, const T B, const T C)
130 {
131 return Min(Min(A, B), C);
132 }
133
134 /** Multiples value by itself */
135 template <class T>
136 static FORCEINLINE T Square(const T A)
137 {
138 return A * A;
139 }
140
141 /** Clamps X to be between Min and Max, inclusive */
142 template <class T>
143 static FORCEINLINE T Clamp(const T X, const T Min, const T Max)
144 {
145 return X < Min ? Min : X < Max ? X : Max;
146 }
147
148 /** Divides two integers and rounds up */
149 template <class T>
150 static FORCEINLINE T DivideAndRoundUp(T Dividend, T Divisor)
151 {
152 return (Dividend + Divisor - 1) / Divisor;
153 }
154
155 template <class T>
156 static FORCEINLINE T DivideAndRoundDown(T Dividend, T Divisor)
157 {
158 return Dividend / Divisor;
159 }
160
161 /**
162 * Computes the sine and cosine of a scalar float.
163 *
164 * @param ScalarSin Pointer to where the Sin result should be stored
165 * @param ScalarCos Pointer to where the Cos result should be stored
166 * @param Value input angles
167 */
168 static FORCEINLINE void SinCos(float* ScalarSin, float* ScalarCos, float Value)
169 {
170 // Map Value to y in [-pi,pi], x = 2*pi*quotient + remainder.
171 float quotient = INV_PI * 0.5f * Value;
172 if (Value >= 0.0f)
173 {
174 quotient = (float)(int)(quotient + 0.5f);
175 }
176 else
177 {
178 quotient = (float)(int)(quotient - 0.5f);
179 }
180 float y = Value - 2.0f * PI * quotient;
181
182 // Map y to [-pi/2,pi/2] with sin(y) = sin(Value).
183 float sign;
184 if (y > HALF_PI)
185 {
186 y = PI - y;
187 sign = -1.0f;
188 }
189 else if (y < -HALF_PI)
190 {
191 y = -PI - y;
192 sign = -1.0f;
193 }
194 else
195 {
196 sign = +1.0f;
197 }
198
199 float y2 = y * y;
200
201 // 11-degree minimax approximation
202 *ScalarSin = (((((-2.3889859e-08f * y2 + 2.7525562e-06f) * y2 - 0.00019840874f) * y2 + 0.0083333310f) * y2 -
203 0.16666667f) * y2 + 1.0f) * y;
204
205 // 10-degree minimax approximation
206 float p = ((((-2.6051615e-07f * y2 + 2.4760495e-05f) * y2 - 0.0013888378f) * y2 + 0.041666638f) * y2 - 0.5f) * y2 +
207 1.0f;
208 *ScalarCos = sign * p;
209 }
210
211
212 // Note: We use FASTASIN_HALF_PI instead of HALF_PI inside of FastASin(), since it was the value that accompanied the minimax coefficients below.
213 // It is important to use exactly the same value in all places inside this function to ensure that FastASin(0.0f) == 0.0f.
214 // For comparison:
215 // HALF_PI == 1.57079632679f == 0x3fC90FDB
216 // FASTASIN_HALF_PI == 1.5707963050f == 0x3fC90FDA
217#define FASTASIN_HALF_PI (1.5707963050f)
218
219 /**
220 * Computes the ASin of a scalar float.
221 *
222 * @param Value input angle
223 * @return ASin of Value
224 */
225 static FORCEINLINE float FastAsin(float Value)
226 {
227 // Clamp input to [-1,1].
228 bool nonnegative = Value >= 0.0f;
229 float x = Abs(Value);
230 float omx = 1.0f - x;
231 if (omx < 0.0f)
232 {
233 omx = 0.0f;
234 }
235 float root = Sqrt(omx);
236 // 7-degree minimax approximation
237 float result = ((((((-0.0012624911f * x + 0.0066700901f) * x - 0.0170881256f) * x + 0.0308918810f) * x - 0.0501743046f
238 ) * x + 0.0889789874f) * x - 0.2145988016f) * x + FASTASIN_HALF_PI;
239 result *= root; // acos(|x|)
240 // acos(x) = pi - acos(-x) when x < 0, asin(x) = pi/2 - acos(x)
241 return nonnegative ? FASTASIN_HALF_PI - result : result - FASTASIN_HALF_PI;
242 }
243#undef FASTASIN_HALF_PI
244
245
246 // Conversion Functions
247
248 /**
249 * Converts radians to degrees.
250 * @param RadVal Value in radians.
251 * @return Value in degrees.
252 */
253 template <class T>
254 static FORCEINLINE auto RadiansToDegrees(T const& RadVal) -> decltype(RadVal * (180.f / PI))
255 {
256 return RadVal * (180.f / PI);
257 }
258
259 /**
260 * Converts degrees to radians.
261 * @param DegVal Value in degrees.
262 * @return Value in radians.
263 */
264 template <class T>
265 static FORCEINLINE auto DegreesToRadians(T const& DegVal) -> decltype(DegVal * (PI / 180.f))
266 {
267 return DegVal * (PI / 180.f);
268 }
269
270 /** Find the smallest angle between two headings (in degrees) */
271 static float FindDeltaAngleDegrees(float A1, float A2)
272 {
273 // Find the difference
274 float Delta = A2 - A1;
275
276 // If change is larger than 180
277 if (Delta > 180.0f)
278 {
279 // Flip to negative equivalent
280 Delta = Delta - 360.0f;
281 }
282 else if (Delta < -180.0f)
283 {
284 // Otherwise, if change is smaller than -180
285 // Flip to positive equivalent
286 Delta = Delta + 360.0f;
287 }
288
289 // Return delta in [-180,180] range
290 return Delta;
291 }
292
293 /** Find the smallest angle between two headings (in radians) */
294 static float FindDeltaAngleRadians(float A1, float A2)
295 {
296 // Find the difference
297 float Delta = A2 - A1;
298
299 // If change is larger than PI
300 if (Delta > PI)
301 {
302 // Flip to negative equivalent
303 Delta = Delta - PI * 2.0f;
304 }
305 else if (Delta < -PI)
306 {
307 // Otherwise, if change is smaller than -PI
308 // Flip to positive equivalent
309 Delta = Delta + PI * 2.0f;
310 }
311
312 // Return delta in [-PI,PI] range
313 return Delta;
314 }
315
316 /** Given a heading which may be outside the +/- PI range, 'unwind' it back into that range. */
317 static float UnwindRadians(float A)
318 {
319 while (A > PI)
320 {
321 A -= (float)PI * 2.0f;
322 }
323
324 while (A < -PI)
325 {
326 A += (float)PI * 2.0f;
327 }
328
329 return A;
330 }
331
332 /** Utility to ensure angle is between +/- 180 degrees by unwinding. */
333 static float UnwindDegrees(float A)
334 {
335 while (A > 180.f)
336 {
337 A -= 360.f;
338 }
339
340 while (A < -180.f)
341 {
342 A += 360.f;
343 }
344
345 return A;
346 }
347
348 /** Converts given Polar coordinate pair to Cartesian coordinate system. */
349 static FORCEINLINE void PolarToCartesian(const float Rad, const float Ang, float& OutX, float& OutY)
350 {
351 OutX = Rad * Cos(Ang);
352 OutY = Rad * Sin(Ang);
353 }
354
355 /** Performs a linear interpolation between two values, Alpha ranges from 0-1 */
356 template <class T, class U>
357 static T Lerp(const T& A, const T& B, const U& Alpha)
358 {
359 return (T)(A + Alpha * (B - A));
360 }
361
362 /** Performs a linear interpolation between two values, Alpha ranges from 0-1. Handles full numeric range of T */
363 template <class T>
364 static T LerpStable(const T& A, const T& B, double Alpha)
365 {
366 return (T)((A * (1.0 - Alpha)) + (B * Alpha));
367 }
368
369 /** Performs a linear interpolation between two values, Alpha ranges from 0-1. Handles full numeric range of T */
370 template <class T>
371 static T LerpStable(const T& A, const T& B, float Alpha)
372 {
373 return (T)((A * (1.0f - Alpha)) + (B * Alpha));
374 }
375
376 /** Performs a 2D linear interpolation between four values values, FracX, FracY ranges from 0-1 */
377 template <class T, class U>
378 static T BiLerp(const T& P00, const T& P10, const T& P01, const T& P11, const U& FracX, const U& FracY)
379 {
380 return Lerp(
381 Lerp(P00, P10, FracX),
382 Lerp(P01, P11, FracX),
383 FracY
384 );
385 }
386
387 /**
388 * Performs a cubic interpolation
389 *
390 * @param P - end points
391 * @param T - tangent directions at end points
392 * @param Alpha - distance along spline
393 *
394 * @return Interpolated value
395 */
396 template <class T, class U>
397 static T CubicInterp(const T& P0, const T& T0, const T& P1, const T& T1, const U& A)
398 {
399 const float A2 = A * A;
400 const float A3 = A2 * A;
401
402 return (T)((2 * A3 - 3 * A2 + 1) * P0) + ((A3 - 2 * A2 + A) * T0) + ((A3 - A2) * T1) + ((-2 * A3 + 3 * A2) * P1);
403 }
404
405 /**
406 * Performs a first derivative cubic interpolation
407 *
408 * @param P - end points
409 * @param T - tangent directions at end points
410 * @param Alpha - distance along spline
411 *
412 * @return Interpolated value
413 */
414 template <class T, class U>
415 static T CubicInterpDerivative(const T& P0, const T& T0, const T& P1, const T& T1, const U& A)
416 {
417 T a = 6.f * P0 + 3.f * T0 + 3.f * T1 - 6.f * P1;
418 T b = -6.f * P0 - 4.f * T0 - 2.f * T1 + 6.f * P1;
419 T c = T0;
420
421 const float A2 = A * A;
422
423 return (a * A2) + (b * A) + c;
424 }
425
426 /**
427 * Performs a second derivative cubic interpolation
428 *
429 * @param P - end points
430 * @param T - tangent directions at end points
431 * @param Alpha - distance along spline
432 *
433 * @return Interpolated value
434 */
435 template <class T, class U>
436 static T CubicInterpSecondDerivative(const T& P0, const T& T0, const T& P1, const T& T1, const U& A)
437 {
438 T a = 12.f * P0 + 6.f * T0 + 6.f * T1 - 12.f * P1;
439 T b = -6.f * P0 - 4.f * T0 - 2.f * T1 + 6.f * P1;
440
441 return (a * A) + b;
442 }
443
444 /** Interpolate between A and B, applying an ease in function. Exp controls the degree of the curve. */
445 template <class T>
446 static T InterpEaseIn(const T& A, const T& B, float Alpha, float Exp)
447 {
448 float const ModifiedAlpha = Pow(Alpha, Exp);
449 return Lerp<T>(A, B, ModifiedAlpha);
450 }
451
452 /** Interpolate between A and B, applying an ease out function. Exp controls the degree of the curve. */
453 template <class T>
454 static T InterpEaseOut(const T& A, const T& B, float Alpha, float Exp)
455 {
456 float const ModifiedAlpha = 1.f - Pow(1.f - Alpha, Exp);
457 return Lerp<T>(A, B, ModifiedAlpha);
458 }
459
460 /** Interpolate between A and B, applying an ease in/out function. Exp controls the degree of the curve. */
461 template <class T>
462 static T InterpEaseInOut(const T& A, const T& B, float Alpha, float Exp)
463 {
464 return Lerp<T>(A, B, Alpha < 0.5f
465 ? InterpEaseIn(0.f, 1.f, Alpha * 2.f, Exp) * 0.5f
466 : InterpEaseOut(0.f, 1.f, Alpha * 2.f - 1.f, Exp) * 0.5f + 0.5f);
467 }
468
469 /** Interpolation between A and B, applying a step function. */
470 template <class T>
471 static T InterpStep(const T& A, const T& B, float Alpha, int32 Steps)
472 {
473 if (Steps <= 1 || Alpha <= 0)
474 {
475 return A;
476 }
477 if (Alpha >= 1)
478 {
479 return B;
480 }
481
482 const float StepsAsFloat = static_cast<float>(Steps);
483 const float NumIntervals = StepsAsFloat - 1.f;
485 return Lerp<T>(A, B, ModifiedAlpha);
486 }
487
488 /** Interpolation between A and B, applying a sinusoidal in function. */
489 template <class T>
490 static T InterpSinIn(const T& A, const T& B, float Alpha)
491 {
492 float const ModifiedAlpha = -1.f * Cos(Alpha * HALF_PI) + 1.f;
493 return Lerp<T>(A, B, ModifiedAlpha);
494 }
495
496 /** Interpolation between A and B, applying a sinusoidal out function. */
497 template <class T>
498 static T InterpSinOut(const T& A, const T& B, float Alpha)
499 {
500 float const ModifiedAlpha = Sin(Alpha * HALF_PI);
501 return Lerp<T>(A, B, ModifiedAlpha);
502 }
503
504 /** Interpolation between A and B, applying a sinusoidal in/out function. */
505 template <class T>
506 static T InterpSinInOut(const T& A, const T& B, float Alpha)
507 {
508 return Lerp<T>(A, B, Alpha < 0.5f
509 ? InterpSinIn(0.f, 1.f, Alpha * 2.f) * 0.5f
510 : InterpSinOut(0.f, 1.f, Alpha * 2.f - 1.f) * 0.5f + 0.5f);
511 }
512
513 /** Interpolation between A and B, applying an exponential in function. */
514 template <class T>
515 static T InterpExpoIn(const T& A, const T& B, float Alpha)
516 {
517 float const ModifiedAlpha = Alpha == 0.f ? 0.f : Pow(2.f, 10.f * (Alpha - 1.f));
518 return Lerp<T>(A, B, ModifiedAlpha);
519 }
520
521 /** Interpolation between A and B, applying an exponential out function. */
522 template <class T>
523 static T InterpExpoOut(const T& A, const T& B, float Alpha)
524 {
525 float const ModifiedAlpha = Alpha == 1.f ? 1.f : -Pow(2.f, -10.f * Alpha) + 1.f;
526 return Lerp<T>(A, B, ModifiedAlpha);
527 }
528
529 /** Interpolation between A and B, applying an exponential in/out function. */
530 template <class T>
531 static T InterpExpoInOut(const T& A, const T& B, float Alpha)
532 {
533 return Lerp<T>(A, B, Alpha < 0.5f
534 ? InterpExpoIn(0.f, 1.f, Alpha * 2.f) * 0.5f
535 : InterpExpoOut(0.f, 1.f, Alpha * 2.f - 1.f) * 0.5f + 0.5f);
536 }
537
538 /** Interpolation between A and B, applying a circular in function. */
539 template <class T>
540 static T InterpCircularIn(const T& A, const T& B, float Alpha)
541 {
542 float const ModifiedAlpha = -1.f * (Sqrt(1.f - Alpha * Alpha) - 1.f);
543 return Lerp<T>(A, B, ModifiedAlpha);
544 }
545
546 /** Interpolation between A and B, applying a circular out function. */
547 template <class T>
548 static T InterpCircularOut(const T& A, const T& B, float Alpha)
549 {
550 Alpha -= 1.f;
551 float const ModifiedAlpha = Sqrt(1.f - Alpha * Alpha);
552 return Lerp<T>(A, B, ModifiedAlpha);
553 }
554
555 /** Interpolation between A and B, applying a circular in/out function. */
556 template <class T>
557 static T InterpCircularInOut(const T& A, const T& B, float Alpha)
558 {
559 return Lerp<T>(A, B, Alpha < 0.5f
560 ? InterpCircularIn(0.f, 1.f, Alpha * 2.f) * 0.5f
561 : InterpCircularOut(0.f, 1.f, Alpha * 2.f - 1.f) * 0.5f + 0.5f);
562 }
563
564 /*
565 * Cubic Catmull-Rom Spline interpolation. Based on http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf
566 * Curves are guaranteed to pass through the control points and are easily chained together.
567 * Equation supports abitrary parameterization. eg. Uniform=0,1,2,3 ; chordal= |Pn - Pn-1| ; centripetal = |Pn - Pn-1|^0.5
568 * P0 - The control point preceding the interpolation range.
569 * P1 - The control point starting the interpolation range.
570 * P2 - The control point ending the interpolation range.
571 * P3 - The control point following the interpolation range.
572 * T0-3 - The interpolation parameters for the corresponding control points.
573 * T - The interpolation factor in the range 0 to 1. 0 returns P1. 1 returns P2.
574 */
575 template <class U>
576 static U CubicCRSplineInterp(const U& P0, const U& P1, const U& P2, const U& P3, const float T0, const float T1,
577 const float T2, const float T3, const float T)
578 {
579 //Based on http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf
580 float InvT1MinusT0 = 1.0f / (T1 - T0);
581 U L01 = (P0 * ((T1 - T) * InvT1MinusT0)) + (P1 * ((T - T0) * InvT1MinusT0));
582 float InvT2MinusT1 = 1.0f / (T2 - T1);
583 U L12 = (P1 * ((T2 - T) * InvT2MinusT1)) + (P2 * ((T - T1) * InvT2MinusT1));
584 float InvT3MinusT2 = 1.0f / (T3 - T2);
585 U L23 = (P2 * ((T3 - T) * InvT3MinusT2)) + (P3 * ((T - T2) * InvT3MinusT2));
586
587 float InvT2MinusT0 = 1.0f / (T2 - T0);
588 U L012 = (L01 * ((T2 - T) * InvT2MinusT0)) + (L12 * ((T - T0) * InvT2MinusT0));
589 float InvT3MinusT1 = 1.0f / (T3 - T1);
590 U L123 = (L12 * ((T3 - T) * InvT3MinusT1)) + (L23 * ((T - T1) * InvT3MinusT1));
591
592 return ((L012 * ((T2 - T) * InvT2MinusT1)) + (L123 * ((T - T1) * InvT2MinusT1)));
593 }
594
595 // Geometry intersection
596
597 /**
598 * 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
599 * @param F Floating point value to convert
600 * @return The rounded integer
601 */
602 static FORCEINLINE float RoundFromZero(float F)
603 {
604 return F < 0.0f ? FloorToFloat(F) : CeilToFloat(F);
605 }
606
607 static FORCEINLINE double RoundFromZero(double F)
608 {
609 return F < 0.0 ? FloorToDouble(F) : CeilToDouble(F);
610 }
611
612 /**
613 * 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
614 * @param F Floating point value to convert
615 * @return The rounded integer
616 */
617 static FORCEINLINE float RoundToZero(float F)
618 {
619 return F < 0.0f ? CeilToFloat(F) : FloorToFloat(F);
620 }
621
622 static FORCEINLINE double RoundToZero(double F)
623 {
624 return F < 0.0 ? CeilToDouble(F) : FloorToDouble(F);
625 }
626
627 /**
628 * Converts a floating point number to an integer which is more negative: 0.1 becomes 0, -0.1 becomes -1
629 * @param F Floating point value to convert
630 * @return The rounded integer
631 */
632 static FORCEINLINE float RoundToNegativeInfinity(float F)
633 {
634 return FloorToFloat(F);
635 }
636
637 static FORCEINLINE double RoundToNegativeInfinity(double F)
638 {
639 return FloorToDouble(F);
640 }
641
642 /**
643 * Converts a floating point number to an integer which is more positive: 0.1 becomes 1, -0.1 becomes 0
644 * @param F Floating point value to convert
645 * @return The rounded integer
646 */
647 static FORCEINLINE float RoundToPositiveInfinity(float F)
648 {
649 return CeilToFloat(F);
650 }
651
652 static FORCEINLINE double RoundToPositiveInfinity(double F)
653 {
654 return CeilToDouble(F);
655 }
656
657 /**
658 * Returns a smooth Hermite interpolation between 0 and 1 for the value X (where X ranges between A and B)
659 * Clamped to 0 for X <= A and 1 for X >= B.
660 *
661 * @param A Minimum value of X
662 * @param B Maximum value of X
663 * @param X Parameter
664 *
665 * @return Smoothed value between 0 and 1
666 */
667 static float SmoothStep(float A, float B, float X)
668 {
669 if (X < A)
670 {
671 return 0.0f;
672 }
673 if (X >= B)
674 {
675 return 1.0f;
676 }
677 const float InterpFraction = (X - A) / (B - A);
678 return InterpFraction * InterpFraction * (3.0f - 2.0f * InterpFraction);
679 }
680
681 // Use the Euclidean method to find the GCD
682 static int32 GreatestCommonDivisor(int32 a, int32 b)
683 {
684 while (b != 0)
685 {
686 int32 t = b;
687 b = a % b;
688 a = t;
689 }
690 return a;
691 }
692
693 // LCM = a/gcd * b
694 // a and b are the number we want to find the lcm
695 static int32 LeastCommonMultiplier(int32 a, int32 b)
696 {
697 int32 CurrentGcd = GreatestCommonDivisor(a, b);
698 return CurrentGcd == 0 ? 0 : a / CurrentGcd * b;
699 }
700};
static unsigned int GetBuildUniqueId()
Definition Atlas.h:30
ARK_API LPVOID GetDataAddress(const std::string &name)
Definition Base.cpp:15
ARK_API BitField GetBitField(LPVOID base, const std::string &name)
Definition Base.cpp:25
ARK_API BitField GetBitField(const void *base, const std::string &name)
Definition Base.cpp:20
#define ARK_API
Definition Base.h:9
ARK_API DWORD64 GetAddress(const void *base, const std::string &name)
Definition Base.cpp:5
ARK_API LPVOID GetAddress(const std::string &name)
Definition Base.cpp:10
FPlatformTypes::CHAR16 UCS2CHAR
A 16-bit character containing a UCS2 (Unicode, 16-bit, fixed-width) code unit, used for compatibility...
Definition BasicTypes.h:124
@ INDEX_NONE
Definition BasicTypes.h:144
FWindowsPlatformTypes FPlatformTypes
Definition BasicTypes.h:94
#define PLATFORM_LITTLE_ENDIAN
Definition BasicTypes.h:12
FPlatformTypes::CHAR8 UTF8CHAR
An 8-bit character containing a UTF8 (Unicode, 8-bit, variable-width) code unit.
Definition BasicTypes.h:122
ENoInit
Definition BasicTypes.h:151
@ NoInit
Definition BasicTypes.h:151
#define check(expr)
Definition BasicTypes.h:14
FPlatformTypes::CHAR16 UTF16CHAR
A 16-bit character containing a UTF16 (Unicode, 16-bit, variable-width) code unit.
Definition BasicTypes.h:126
#define CONSTEXPR
Definition BasicTypes.h:7
EForceInit
Definition BasicTypes.h:147
@ ForceInitToZero
Definition BasicTypes.h:149
@ ForceInit
Definition BasicTypes.h:148
FPlatformTypes::CHAR32 UTF32CHAR
A 32-bit character containing a UTF32 (Unicode, 32-bit, fixed-width) code unit.
Definition BasicTypes.h:128
#define THRESH_VECTOR_NORMALIZED
#define THRESH_NORMALS_ARE_PARALLEL
#define THRESH_POINTS_ARE_SAME
#define SMALL_NUMBER
#define THRESH_POINT_ON_PLANE
#define PI
#define THRESH_NORMALS_ARE_ORTHOGONAL
#define KINDA_SMALL_NUMBER
#define BIG_NUMBER
#define FASTASIN_HALF_PI
#define HALF_PI
#define INV_PI
FORCEINLINE float ComputeSquaredDistanceFromBoxToPoint(const FVector &Mins, const FVector &Maxs, const FVector &Point)
Definition Vector.h:893
FORCEINLINE FVector ClampVector(const FVector &V, const FVector &Min, const FVector &Max)
Definition Vector.h:1646
FORCEINLINE FVector operator*(float Scale, const FVector &V)
Definition Vector.h:870
ApiUtils & operator=(ApiUtils &&)=delete
ApiUtils()=default
void SetCheatManager(UShooterCheatManager *cheatmanager)
Definition ApiUtils.cpp:44
void SetWorld(UWorld *uworld)
Definition ApiUtils.cpp:9
ApiUtils & operator=(const ApiUtils &)=delete
void SetShooterGameMode(AShooterGameMode *shooter_game_mode)
Definition ApiUtils.cpp:21
std::unordered_map< uint64, AShooterPlayerController * > steam_id_map_
Definition ApiUtils.h:38
UShooterCheatManager * GetCheatManager() const override
Returns a point to URCON CheatManager.
Definition ApiUtils.cpp:93
UWorld * u_world_
Definition ApiUtils.h:34
ApiUtils(ApiUtils &&)=delete
AShooterGameMode * shooter_game_mode_
Definition ApiUtils.h:35
AShooterGameMode * GetShooterGameMode() const override
Returns a pointer to AShooterGameMode.
Definition ApiUtils.cpp:26
void RemovePlayerController(AShooterPlayerController *player_controller)
Definition ApiUtils.cpp:62
UShooterCheatManager * cheatmanager_
Definition ApiUtils.h:37
void SetPlayerController(AShooterPlayerController *player_controller)
Definition ApiUtils.cpp:49
ServerStatus GetStatus() const override
Returns the current server status.
Definition ApiUtils.cpp:38
ServerStatus status_
Definition ApiUtils.h:36
AShooterPlayerController * FindPlayerFromSteamId_Internal(uint64 steam_id) const override
Definition ApiUtils.cpp:75
~ApiUtils() override=default
void SetStatus(ServerStatus status)
Definition ApiUtils.cpp:33
UWorld * GetWorld() const override
Returns a pointer to UWorld.
Definition ApiUtils.cpp:14
ApiUtils(const ApiUtils &)=delete
static FString GetSteamName(AController *player_controller)
Returns the steam name of player.
static FORCEINLINE FString GetItemBlueprint(UPrimalItem *item)
Returns blueprint from UPrimalItem.
static FVector GetPosition(APlayerController *player_controller)
Returns the position of a player.
uint64 GetSteamIDForPlayerID(int player_id) const
static FORCEINLINE FString GetClassBlueprint(UClass *the_class)
Returns blueprint path from any UClass.
void SendServerMessageToAll(FLinearColor msg_color, const T *msg, Args &&... args)
Sends server message to all players. Using fmt::format.
virtual UShooterCheatManager * GetCheatManager() const =0
Returns a point to URCON CheatManager.
UPrimalGameData * GetGameData()
Returns pointer to Primal Game Data.
static bool IsRidingDino(AShooterPlayerController *player_controller)
Returns true if character is riding a dino, false otherwise.
AShooterGameState * GetGameState()
Get Shooter Game State.
virtual ~IApiUtils()=default
AShooterPlayerController * FindPlayerFromSteamName(const FString &steam_name) const
Finds player from the given steam name.
static UShooterCheatManager * GetCheatManagerByPC(AShooterPlayerController *SPC)
Get UShooterCheatManager* of player controller.
static uint64 GetPlayerID(AController *controller)
static bool IsPlayerDead(AShooterPlayerController *player)
Returns true if player is dead, false otherwise.
void SendNotificationToAll(FLinearColor color, float display_scale, float display_time, UTexture2D *icon, const T *msg, Args &&... args)
Sends notification (on-screen message) to all players. Using fmt::format.
APrimalDinoCharacter * SpawnDino(AShooterPlayerController *player, FString blueprint, FVector *location, int lvl, bool force_tame, bool neutered) const
Spawns a dino near player or at specific coordinates.
TArray< AShooterPlayerController * > FindPlayerFromCharacterName(const FString &character_name, ESearchCase::Type search, bool full_match) const
Finds all matching players from the given character name.
static FORCEINLINE FString GetBlueprint(UObjectBase *object)
Returns blueprint path from any UObject.
static FString GetCharacterName(AShooterPlayerController *player_controller, bool include_first_name=true, bool include_last_name=true)
Returns the character name of player.
TArray< AActor * > GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType)
Gets all actors in radius at location.
void SendChatMessageToAll(const FString &sender_name, const T *msg, Args &&... args)
Sends chat message to all players. Using fmt::format.
TArray< AActor * > GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType, TArray< AActor * > ignores)
Gets all actors in radius at location, with ignore actors.
virtual AShooterGameMode * GetShooterGameMode() const =0
Returns a pointer to AShooterGameMode.
static uint64 GetSteamIdFromController(AController *controller)
Returns Steam ID from player controller.
virtual UWorld * GetWorld() const =0
Returns a pointer to UWorld.
static bool TeleportToPos(AShooterPlayerController *player_controller, const FVector &pos)
Teleports player to the given position.
void SendNotification(AShooterPlayerController *player_controller, FLinearColor color, float display_scale, float display_time, UTexture2D *icon, const T *msg, Args &&... args)
Sends notification (on-screen message) to the specific player. Using fmt::format.
static uint64 GetPlayerID(APrimalCharacter *character)
virtual AShooterPlayerController * FindPlayerFromSteamId_Internal(uint64 steam_id) const =0
AShooterPlayerController * FindControllerFromCharacter(AShooterCharacter *character) const
Finds player controller from the given player character.
static APrimalDinoCharacter * GetRidingDino(AShooterPlayerController *player_controller)
Returns the dino the character is riding.
static FString GetIPAddress(AShooterPlayerController *player_controller)
Returns IP address of player.
AShooterPlayerController * FindPlayerFromSteamId(uint64 steam_id) const
Finds player from the given steam id.
virtual ServerStatus GetStatus() const =0
Returns the current server status.
void SendServerMessage(AShooterPlayerController *player_controller, FLinearColor msg_color, const T *msg, Args &&... args)
Sends server message to the specific player. Using fmt::format.
static std::optional< FString > TeleportToPlayer(AShooterPlayerController *me, AShooterPlayerController *him, bool check_for_dino, float max_dist)
Teleport one player to another.
static int GetInventoryItemCount(AShooterPlayerController *player_controller, const FString &item_name)
Counts a specific items quantity.
void SendChatMessage(AShooterPlayerController *player_controller, const FString &sender_name, const T *msg, Args &&... args)
Sends chat message to the specific player. Using fmt::format.
FString Replace(const TCHAR *From, const TCHAR *To, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2766
FORCEINLINE bool FindChar(TCHAR InChar, int32 &Index) const
Definition FString.h:1169
FORCEINLINE FString Mid(int32 Start, int32 Count=INT_MAX) const
Definition FString.h:1099
FORCEINLINE friend bool operator==(const FString &Lhs, const FString &Rhs)
Definition FString.h:994
FORCEINLINE bool FindLastChar(TCHAR InChar, int32 &Index) const
Definition FString.h:1181
FORCEINLINE FString(const CharType *Src, typename TEnableIf< TIsCharType< CharType >::Value >::Type *Dummy=nullptr)
Definition FString.h:98
FORCEINLINE friend FString operator+(const TCHAR *Lhs, FString &&Rhs)
Definition FString.h:687
bool StartsWith(const FString &InPrefix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2143
FORCEINLINE bool Equals(const FString &Other, ESearchCase::Type SearchCase=ESearchCase::CaseSensitive) const
Definition FString.h:1221
bool EndsWith(const TCHAR *InSuffix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2155
FORCEINLINE bool IsEmpty() const
Definition FString.h:241
FORCEINLINE int32 Len() const
Definition FString.h:1069
FORCEINLINE friend FString operator+(FString &&Lhs, const TCHAR *Rhs)
Definition FString.h:713
FORCEINLINE int32 Add(const ElementType &Item)
Definition TArray.h:1564
int32 Remove(const ElementType &Item)
Definition TArray.h:1709
FORCEINLINE ObjectType * Get() const
IApiUtils & GetApiUtils()
Definition ApiUtils.cpp:99
@ CaseSensitive
Definition FString.h:28
Definition json.hpp:4518
FVector & DefaultActorLocationField()
Definition Actor.h:920
int & TargetingTeamField()
Definition Actor.h:902
USceneComponent * RootComponentField()
Definition Actor.h:911
APlayerState * PlayerStateField()
Definition Actor.h:2062
UCheatManager * CheatManagerField()
Definition Actor.h:2133
FString * GetPlayerNetworkAddress(FString *result)
Definition Actor.h:2292
FUniqueNetIdRepl & UniqueIdField()
Definition Actor.h:1782
FString & PlayerNameField()
Definition Actor.h:1776
bool TeleportTo(FVector *DestLocation, FRotator *DestRotation, bool bIsATest, bool bNoCheck)
Definition Actor.h:4554
UPrimalInventoryComponent * MyInventoryComponentField()
Definition Actor.h:3798
bool IsDead()
Definition Actor.h:4360
void DoNeuter_Implementation()
Definition Actor.h:7051
static UClass * GetPrivateStaticClass()
Definition Actor.h:6963
void TameDino(AShooterPlayerController *ForPC, bool bIgnoreMaxTameLimit, int OverrideTamingTeamID)
Definition Actor.h:7328
int & TamingTeamIDField()
Definition Actor.h:6194
FString & TamerStringField()
Definition Actor.h:6057
int & AbsoluteBaseLevelField()
Definition Actor.h:6324
UPrimalPlayerData * GetPlayerData()
Definition Actor.h:5166
APrimalDinoCharacter * GetRidingDino()
Definition Actor.h:5159
unsigned __int64 GetSteamIDForPlayerID(int playerDataID)
Definition GameMode.h:1620
void AddPlayerID(int playerDataID, unsigned __int64 netUniqueID)
Definition GameMode.h:1534
__int64 & LinkedPlayerIDField()
Definition Actor.h:2504
void SetPlayerPos(float X, float Y, float Z)
Definition Actor.h:3202
AActor * SpawnActor(FString *blueprintPath, float spawnDistance, float spawnYOffset, float ZOffset, bool bDoDeferBeginPlay)
Definition Actor.h:3222
AShooterCharacter * GetPlayerCharacter()
Definition Actor.h:2916
FString * GetPlayerName(FString *result)
Definition Actor.h:1902
void SetTribeTamingDinoSettings(APrimalDinoCharacter *aDinoChar)
Definition Actor.h:1986
DWORD64 offset
Definition Base.h:674
DWORD bit_position
Definition Base.h:675
ULONGLONG length
Definition Base.h:677
ULONGLONG num_bits
Definition Base.h:676
Definition Base.h:181
Definition Actor.h:10035
ECanvasAllowModes
Definition Base.h:316
@ Allow_DeleteOnRender
Definition Base.h:318
@ Allow_Flush
Definition Base.h:317
EElementType
Definition Base.h:309
@ ET_MAX
Definition Base.h:312
@ ET_Line
Definition Base.h:310
@ ET_Triangle
Definition Base.h:311
Definition Other.h:244
Definition Actor.h:349
static FORCEINLINE double CeilToDouble(double F)
static FORCEINLINE float CeilToFloat(float F)
static FORCEINLINE float Acos(float Value)
static FORCEINLINE float InvSqrt(float F)
static CONSTEXPR FORCEINLINE T Min(const T A, const T B)
static FORCEINLINE float FRand()
static CONSTEXPR FORCEINLINE float FloatSelect(float Comparand, float ValueGEZero, float ValueLTZero)
static FORCEINLINE float Sqrt(float Value)
static FORCEINLINE float FloorToFloat(float F)
static FORCEINLINE double FloorToDouble(double F)
static FORCEINLINE float Sin(float Value)
static CONSTEXPR FORCEINLINE T Max(const T A, const T B)
static FORCEINLINE bool IsFinite(float A)
static CONSTEXPR FORCEINLINE int32 TruncToInt(float F)
static FORCEINLINE float Cos(float Value)
static CONSTEXPR FORCEINLINE T Abs(const T A)
unsigned long long uint64
Definition BasicTypes.h:55
unsigned char uint8
Definition BasicTypes.h:52
decltype(nullptr) TYPE_OF_NULLPTR
Definition BasicTypes.h:77
signed short int int16
Definition BasicTypes.h:59
SelectIntPointerType< int32, int64, sizeof(void *)>::TIntPointe PTRINT)
Definition BasicTypes.h:72
unsigned short int uint16
Definition BasicTypes.h:53
unsigned int uint32
Definition BasicTypes.h:54
SelectIntPointerType< uint32, uint64, sizeof(void *)>::TIntPointe UPTRINT)
Definition BasicTypes.h:71
signed long long int64
Definition BasicTypes.h:61
Definition Actor.h:9443
int32 X
Definition IntPoint.h:17
int32 Y
Definition IntPoint.h:20
int32 Z
Definition IntVector.h:25
int32 Y
Definition IntVector.h:22
FIntVector(FVector InVector)
Definition Vector.h:936
int32 X
Definition IntVector.h:19
Definition Inventory.h:50
Definition Base.h:120
Definition Base.h:216
float G
Definition Color.h:36
float B
Definition Color.h:37
float R
Definition Color.h:35
static float UnwindRadians(float A)
static T InterpCircularOut(const T &A, const T &B, float Alpha)
static T InterpEaseInOut(const T &A, const T &B, float Alpha, float Exp)
static T InterpExpoInOut(const T &A, const T &B, float Alpha)
static FORCEINLINE double RoundToNegativeInfinity(double F)
static FORCEINLINE int32 RandRange(int32 Min, int32 Max)
static T BiLerp(const T &P00, const T &P10, const T &P01, const T &P11, const U &FracX, const U &FracY)
static T LerpStable(const T &A, const T &B, double Alpha)
static FORCEINLINE float RandRange(float InMin, float InMax)
static float UnwindDegrees(float A)
static FORCEINLINE float FastAsin(float Value)
static FORCEINLINE float RoundToNegativeInfinity(float F)
static float FindDeltaAngleRadians(float A1, float A2)
static 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)
static T InterpCircularInOut(const T &A, const T &B, float Alpha)
static float SmoothStep(float A, float B, float X)
static FORCEINLINE T Clamp(const T X, const T Min, const T Max)
static FORCEINLINE float RoundFromZero(float F)
static T CubicInterpSecondDerivative(const T &P0, const T &T0, const T &P1, const T &T1, const U &A)
static int32 LeastCommonMultiplier(int32 a, int32 b)
static FORCEINLINE T Square(const T A)
static T Lerp(const T &A, const T &B, const U &Alpha)
static FORCEINLINE T Max3(const T A, const T B, const T C)
static T InterpEaseOut(const T &A, const T &B, float Alpha, float Exp)
static FORCEINLINE T DivideAndRoundDown(T Dividend, T Divisor)
static FORCEINLINE float RoundToZero(float F)
static FORCEINLINE int32 RandHelper(int32 A)
static int32 GreatestCommonDivisor(int32 a, int32 b)
static T InterpSinOut(const T &A, const T &B, float Alpha)
static T InterpEaseIn(const T &A, const T &B, float Alpha, float Exp)
static FORCEINLINE float RoundToPositiveInfinity(float F)
static FORCEINLINE void PolarToCartesian(const float Rad, const float Ang, float &OutX, float &OutY)
static FORCEINLINE float FRandRange(float InMin, float InMax)
static float FindDeltaAngleDegrees(float A1, float A2)
static FORCEINLINE bool IsPowerOfTwo(T Value)
static FORCEINLINE auto RadiansToDegrees(T const &RadVal) -> decltype(RadVal *(180.f/PI))
static T InterpCircularIn(const T &A, const T &B, float Alpha)
static T InterpStep(const T &A, const T &B, float Alpha, int32 Steps)
static FORCEINLINE T DivideAndRoundUp(T Dividend, T Divisor)
static T InterpExpoOut(const T &A, const T &B, float Alpha)
static T CubicInterpDerivative(const T &P0, const T &T0, const T &P1, const T &T1, const U &A)
static T CubicInterp(const T &P0, const T &T0, const T &P1, const T &T1, const U &A)
static FORCEINLINE double RoundToPositiveInfinity(double F)
static FORCEINLINE void SinCos(float *ScalarSin, float *ScalarCos, float Value)
static FORCEINLINE T Min3(const T A, const T B, const T C)
static FORCEINLINE auto DegreesToRadians(T const &DegVal) -> decltype(DegVal *(PI/180.f))
static T LerpStable(const T &A, const T &B, float Alpha)
static T InterpExpoIn(const T &A, const T &B, float Alpha)
static FORCEINLINE double RoundToZero(double F)
static T InterpSinIn(const T &A, const T &B, float Alpha)
static FORCEINLINE double RoundFromZero(double F)
static T InterpSinInOut(const T &A, const T &B, float Alpha)
static FORCEINLINE bool RandBool()
Definition Other.h:87
Definition Actor.h:9709
Definition Actor.h:9701
Definition Base.h:191
unsigned __int64 & PlayerDataIDField()
Definition Actor.h:5466
Definition Base.h:360
FORCEINLINE FRotator(float InPitch, float InYaw, float InRoll)
Definition Rotator.h:375
TSharedPtr< FUniqueNetId > UniqueNetId
Definition Actor.h:190
float Y
Definition Vector2D.h:22
float X
Definition Vector2D.h:19
FORCEINLINE FVector operator+(float Bias) const
Definition Vector.h:1145
FORCEINLINE FVector operator*=(float Scale)
Definition Vector.h:1210
bool operator!=(const FVector &V) const
Definition Vector.h:1176
FORCEINLINE FVector()
Definition Vector.h:41
static float Triple(const FVector &X, const FVector &Y, const FVector &Z)
Definition Vector.h:1044
static bool Orthogonal(const FVector &Normal1, const FVector &Normal2, float OrthogonalCosineThreshold=THRESH_NORMALS_ARE_ORTHOGONAL)
Definition Vector.h:1031
static bool Parallel(const FVector &Normal1, const FVector &Normal2, float ParallelCosineThreshold=THRESH_NORMALS_ARE_PARALLEL)
Definition Vector.h:1019
FORCEINLINE FVector operator-(const FVector &V) const
Definition Vector.h:1135
FORCEINLINE FVector operator-=(const FVector &V)
Definition Vector.h:1204
FVector GetSafeNormal(float Tolerance=SMALL_NUMBER) const
Definition Vector.h:1520
static FVector VectorPlaneProject(const FVector &V, const FVector &PlaneNormal)
Definition Vector.h:1014
FVector operator/=(const FVector &V)
Definition Vector.h:1229
static bool PointsAreSame(const FVector &P, const FVector &Q)
Definition Vector.h:968
FORCEINLINE FVector(float InF)
Definition Vector.h:1062
FORCEINLINE FVector operator+=(const FVector &V)
Definition Vector.h:1198
FORCEINLINE FVector operator-() const
Definition Vector.h:1192
FORCEINLINE FVector operator^(const FVector &V) const
Definition Vector.h:1105
bool IsUniform(float Tolerance=KINDA_SMALL_NUMBER) const
Definition Vector.h:1510
FORCEINLINE FVector operator-(float Bias) const
Definition Vector.h:1140
FRotator ToOrientationRotator() const
FVector(const FLinearColor &InColor)
Definition Vector.h:1072
FVector MirrorByVector(const FVector &MirrorNormal) const
Definition Vector.h:1515
FVector Reciprocal() const
Definition Vector.h:1476
static FORCEINLINE float DistSquaredXY(const FVector &V1, const FVector &V2)
Definition Vector.h:1627
float X
Definition Vector.h:27
static bool PointsAreNear(const FVector &Point1, const FVector &Point2, float Dist)
Definition Vector.h:987
bool InitFromString(const FString &InSourceString)
static FORCEINLINE float DotProduct(const FVector &A, const FVector &B)
Definition Vector.h:1125
float Y
Definition Vector.h:30
FVector ComponentMax(const FVector &Other) const
Definition Vector.h:1301
void ToDirectionAndLength(FVector &OutDir, float &OutLength) const
Definition Vector.h:1361
FORCEINLINE float operator|(const FVector &V) const
Definition Vector.h:1120
FRotator Rotation() const
FORCEINLINE FVector GetUnsafeNormal() const
Definition Vector.h:1392
FVector GetClampedToMaxSize(float MaxSize) const
Definition Vector.h:1428
FORCEINLINE FVector operator*(const FVector &V) const
Definition Vector.h:1161
void FindBestAxisVectors(FVector &Axis1, FVector &Axis2) const
float Size2D() const
Definition Vector.h:1321
FVector(FIntVector InVector)
Definition Vector.h:1077
static const FVector ZeroVector
Definition Vector.h:38
float SizeSquared2D() const
Definition Vector.h:1326
FVector GetSafeNormal2D(float Tolerance=SMALL_NUMBER) const
Definition Vector.h:1537
float & Component(int32 Index)
Definition Vector.h:1466
static FORCEINLINE float BoxPushOut(const FVector &Normal, const FVector &Size)
Definition Vector.h:1632
FVector operator/(float Scale) const
Definition Vector.h:1155
static FVector RadiansToDegrees(const FVector &RadVector)
Definition Vector.h:1052
float GetAbsMin() const
Definition Vector.h:1291
FVector2D UnitCartesianToSpherical() const
bool IsZero() const
Definition Vector.h:1339
FVector GetAbs() const
Definition Vector.h:1306
static float PointPlaneDist(const FVector &Point, const FVector &PlaneBase, const FVector &PlaneNormal)
Definition Vector.h:997
FVector BoundToCube(float Radius) const
Definition Vector.h:1398
static FORCEINLINE float DistSquared(const FVector &V1, const FVector &V2)
Definition Vector.h:1622
FORCEINLINE FVector GetSignVector() const
Definition Vector.h:1376
FORCEINLINE FVector operator/(const FVector &V) const
Definition Vector.h:1166
static FORCEINLINE float Dist2D(const FVector &V1, const FVector &V2)
Definition Vector.h:751
FVector ComponentMin(const FVector &Other) const
Definition Vector.h:1296
float Size() const
Definition Vector.h:1311
float GetMin() const
Definition Vector.h:1286
float Z
Definition Vector.h:33
FString ToString() const
Definition Vector.h:1637
float & operator[](int32 Index)
Definition Vector.h:1235
static FORCEINLINE float Dist(const FVector &V1, const FVector &V2)
Definition Vector.h:1612
FVector GridSnap(const float &GridSz) const
static bool Coincident(const FVector &Normal1, const FVector &Normal2, float ParallelCosineThreshold=THRESH_NORMALS_ARE_PARALLEL)
Definition Vector.h:1025
FVector Projection() const
Definition Vector.h:1386
static bool Coplanar(const FVector &Base1, const FVector &Normal1, const FVector &Base2, const FVector &Normal2, float ParallelCosineThreshold=THRESH_NORMALS_ARE_PARALLEL)
Definition Vector.h:1037
FORCEINLINE FVector ProjectOnTo(const FVector &A) const
Definition Vector.h:1572
static FVector PointPlaneProject(const FVector &Point, const FVector &PlaneBase, const FVector &PlaneNormal)
Definition Vector.h:1007
bool IsNormalized() const
Definition Vector.h:1356
FORCEINLINE FVector ProjectOnToNormal(const FVector &Normal) const
Definition Vector.h:1577
static FVector PointPlaneProject(const FVector &Point, const FVector &A, const FVector &B, const FVector &C)
void UnwindEuler()
bool Equals(const FVector &V, float Tolerance=KINDA_SMALL_NUMBER) const
Definition Vector.h:1181
FQuat ToOrientationQuat() const
bool operator==(const FVector &V) const
Definition Vector.h:1171
FVector GetClampedToSize2D(float Min, float Max) const
Definition Vector.h:1418
float SizeSquared() const
Definition Vector.h:1316
float operator[](int32 Index) const
Definition Vector.h:1252
FVector GetClampedToSize(float Min, float Max) const
Definition Vector.h:1408
float GetAbsMax() const
Definition Vector.h:1281
static FORCEINLINE float DistSquared2D(const FVector &V1, const FVector &V2)
Definition Vector.h:770
FVector operator/=(float V)
Definition Vector.h:1216
float GetMax() const
Definition Vector.h:1276
FVector(FIntPoint A)
Definition Vector.h:1082
static FORCEINLINE FVector CrossProduct(const FVector &A, const FVector &B)
Definition Vector.h:1115
FVector operator*=(const FVector &V)
Definition Vector.h:1223
void Set(float InX, float InY, float InZ)
Definition Vector.h:1269
FORCEINLINE FVector operator+(const FVector &V) const
Definition Vector.h:1130
FORCEINLINE FVector operator*(float Scale) const
Definition Vector.h:1150
static FVector DegreesToRadians(const FVector &DegVector)
Definition Vector.h:1057
FORCEINLINE CONSTEXPR FVector(float InX, float InY, float InZ)
Definition Vector.h:1067
FORCEINLINE float CosineAngle2D(FVector B) const
Definition Vector.h:1562
bool AllComponentsEqual(float Tolerance=KINDA_SMALL_NUMBER) const
Definition Vector.h:1186
FVector GetClampedToMaxSize2D(float MaxSize) const
Definition Vector.h:1447
static FORCEINLINE float DistXY(const FVector &V1, const FVector &V2)
Definition Vector.h:1617
static void CreateOrthonormalBasis(FVector &XAxis, FVector &YAxis, FVector &ZAxis)
FORCEINLINE bool IsUnit(float LengthSquaredTolerance=KINDA_SMALL_NUMBER) const
Definition Vector.h:1590
FVector RotateAngleAxis(const float AngleDeg, const FVector &Axis) const
Definition Vector.h:942
bool ContainsNaN() const
Definition Vector.h:1583
float HeadingAngle() const
Definition Vector.h:1595
static float EvaluateBezier(const FVector *ControlPoints, int32 NumPoints, TArray< FVector > &OutPoints)
float Component(int32 Index) const
Definition Vector.h:1471
FORCEINLINE FVector(const FVector2D V, float InZ)
Definition Vector.h:931
bool IsNearlyZero(float Tolerance=KINDA_SMALL_NUMBER) const
Definition Vector.h:1331
FORCEINLINE FVector(EForceInit)
Definition Vector.h:1087
static FORCEINLINE float Distance(const FVector &V1, const FVector &V2)
Definition Vector.h:741
bool Normalize(float Tolerance=SMALL_NUMBER)
Definition Vector.h:1344
Definition UE.h:623
T * Get(bool bEvenIfPendingKill=false)
Definition UE.h:172
FORCEINLINE T * operator->()
Definition UE.h:167
Definition UE.h:399
UObject * GetDefaultObject(bool bCreateIfNeeded)
Definition UE.h:415
Definition UE.h:343
Definition Base.h:215
UClass * ClassField()
Definition UE.h:277
FString * GetFullName(FString *result, UObject *StopOuter)
Definition UE.h:296
bool IsA(UClass *SomeBase)
Definition UE.h:299
Definition UE.h:306
Definition Other.h:211
UPrimalGameData * PrimalGameDataOverrideField()
Definition GameMode.h:878
UPrimalGameData * PrimalGameDataField()
Definition GameMode.h:877
FPrimalPlayerDataStruct * MyDataField()
Definition Actor.h:5507
FVector * GetWorldLocation(FVector *result)
Definition Actor.h:523
Definition UE.h:355
Definition UE.h:817
static TArray< AActor * > * ServerOctreeOverlapActors(TArray< AActor * > *result, UWorld *theWorld, FVector AtLoc, float Radius, EServerOctreeGroup::Type OctreeType, bool bForceActorLocationDistanceCheck)
Definition Other.h:410
TArray< TAutoWeakObjectPtr< APlayerController > > & PlayerControllerListField()
Definition GameMode.h:425
APlayerController * GetFirstPlayerController()
Definition GameMode.h:538
AGameState * GameStateField()
Definition GameMode.h:409