Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kMath.h
Go to the documentation of this file.
1
10 #ifndef K_API_MATH_H
11 #define K_API_MATH_H
12
13 #include <kApi/kApiDef.h>
14
15 kBeginHeader()
16
17
23 typedef kObject kMath;
24
27 #define kMATH_PI (3.1415926535897932384626433832795)
28 #define kMATH_E (2.7182818284590452353602874713527)
29 #define kMATH_SQRT2 (1.4142135623730950488016887242097)
30 #define kMATH_SQRT3 (1.7320508075688772935274463415059)
31
32 #define kMath_RadToDeg_(RAD) kxMath_RadToDeg_(RAD)
33 #define kMath_DegToRad_(DEG) kxMath_DegToRad_(DEG)
34 #define kMath_Abs_(A) kxMath_Abs_(A)
35 #define kMath_Min_(A, B) kxMath_Min_((A), (B))
36 #define kMath_Max_(A, B) kxMath_Max_((A), (B))
37 #define kMath_Sign_(A) kxMath_Sign_(A)
38 #define kMath_Common_Residue_(A,B) kxMath_Common_Residue_((A), (B))
39 #define kMath_Clamp_(V, VMIN, VMAX) kxMath_Clamp_((V), (VMIN), (VMAX))
40 #define kMath_Round8s_(A) kxMath_Round8s_(A)
41 #define kMath_Round8u_(A) kxMath_Round8u_(A)
42 #define kMath_Round16s_(A) kxMath_Round16s_(A)
43 #define kMath_Round16u_(A) kxMath_Round16u_(A)
44 #define kMath_Round32s_(A) kxMath_Round32s_(A)
45 #define kMath_Round32u_(A) kxMath_Round32u_(A)
46 #define kMath_Round64s_(A) kxMath_Round64s_(A)
47 #define kMath_Round64u_(A) kxMath_Round64u_(A)
48
49
62 kFx(kStatus) kMath_FindFirst32s(const k32s* v, kSize count, kComparison comparison, k32s value, kSize* index);
63
75 kFx(kStatus) kMath_FindFirst64f(const k64f* v, kSize count, kComparison comparison, k64f value, kSize* index);
76
88 kFx(kStatus) kMath_FindLast32s(const k32s* v, kSize count, kComparison comparison, k32s value, kSize* index);
89
101 kFx(kStatus) kMath_FindLast64f(const k64f* v, kSize count, kComparison comparison, k64f value, kSize* index);
102
112 kFx(kStatus) kMath_FindMin32s(const k32s* v, kSize count, kSize* index);
113
123 kFx(kStatus) kMath_FindMin32u(const k32u* v, kSize count, kSize* index);
124
134 kFx(kStatus) kMath_FindMin64f(const k64f* v, kSize count, kSize* index);
135
145 kFx(kStatus) kMath_FindMax32s(const k32s* v, kSize count, kSize* index);
146
156 kFx(kStatus) kMath_FindMax32u(const k32u* v, kSize count, kSize* index);
157
167 kFx(kStatus) kMath_FindMax64f(const k64f* v, kSize count, kSize* index);
168
178 kFx(kStatus) kMath_Sum32s(const k32s* v, kSize count, k64s* sum);
179
189 kFx(kStatus) kMath_Sum64f(const k64f* v, kSize count, k64f* sum);
190
200 kFx(kStatus) kMath_Average32s(const k32s* v, kSize count, k64f* average);
201
211 kFx(kStatus) kMath_Average64f(const k64f* v, kSize count, k64f* average);
212
222 kFx(kStatus) kMath_Stdev32s(const k32s* v, kSize count, k64f* stdev);
223
233 kFx(kStatus) kMath_Stdev64f(const k64f* v, kSize count, k64f* stdev);
234
244 kFx(kStatus) kMath_Min32s(const k32s* v, kSize count, k32s* minValue);
245
255 kFx(kStatus) kMath_Min32u(const k32u* v, kSize count, k32u* minValue);
256
266 kFx(kStatus) kMath_Min64f(const k64f* v, kSize count, k64f* minValue);
267
277 kFx(kStatus) kMath_Max32s(const k32s* v, kSize count, k32s* maxValue);
278
288 kFx(kStatus) kMath_Max32u(const k32u* v, kSize count, k32u* maxValue);
289
299 kFx(kStatus) kMath_Max64f(const k64f* v, kSize count, k64f* maxValue);
300
310 kFx(kStatus) kMath_Centroid32s(const k32s* v, kSize count, k64f* centroid);
311
321 kFx(kStatus) kMath_Centroid64f(const k64f* v, kSize count, k64f* centroid);
322
332 kFx(kStatus) kMath_Set32s(k32s* v, kSize count, k32s value);
333
343 kFx(kStatus) kMath_Set64f(k64f* v, kSize count, k64f value);
344
355 kFx(kStatus) kMath_Step32s(k32s* v, kSize count, k32s startValue, k32s increment);
356
367 kFx(kStatus) kMath_Step64f(k64f* v, kSize count, k64f startValue, k64f increment);
368
379 kFx(kStatus) kMath_Span32s(k32s* v, kSize count, k32s startValue, k32s endValue);
380
391 kFx(kStatus) kMath_Span64f(k64f* v, kSize count, k64f startValue, k64f endValue);
392
402 kFx(kStatus) kMath_Abs32s(const k32s* vIn, k32s* vOut, kSize count);
403
413 kFx(kStatus) kMath_Abs64f(const k64f* vIn, k64f* vOut, kSize count);
414
425 kFx(kStatus) kMath_AddC32s(const k32s* vIn, k32s* vOut, kSize count, k32s value);
426
437 kFx(kStatus) kMath_AddC64f(const k64f* vIn, k64f* vOut, kSize count, k64f value);
438
449 kFx(kStatus) kMath_SubC32s(const k32s* vIn, k32s* vOut, kSize count, k32s value);
450
461 kFx(kStatus) kMath_SubC64f(const k64f* vIn, k64f* vOut, kSize count, k64f value);
462
473 kFx(kStatus) kMath_MulC32s(const k32s* vIn, k32s* vOut, kSize count, k32s value);
474
485 kFx(kStatus) kMath_MulC64f(const k64f* vIn, k64f* vOut, kSize count, k64f value);
486
497 kFx(kStatus) kMath_DivC32s(const k32s* vIn, k32s* vOut, kSize count, k32s value);
498
509 kFx(kStatus) kMath_DivC64f(const k64f* vIn, k64f* vOut, kSize count, k64f value);
510
522 kFx(kStatus) kMath_ClampC32s(const k32s* vIn, k32s* vOut, kSize count, k32s minValue, k32s maxValue);
523
535 kFx(kStatus) kMath_ClampC64f(const k64f* vIn, k64f* vOut, kSize count, k64f minValue, k64f maxValue);
536
549 kFx(kStatus) kMath_ReplaceC32s(const k32s* vIn, k32s* vOut, kSize count, kComparison comparison, k32s value, k32s replacement);
550
563 kFx(kStatus) kMath_ReplaceC64f(const k64f* vIn, k64f* vOut, kSize count, kComparison comparison, k64f value, k64f replacement);
564
576 kFx(kStatus) kMath_CompareC32s(const k32s* vIn, kBool* vOut, kSize count, kComparison comparison, k32s value);
577
589 kFx(kStatus) kMath_CompareC64f(const k64f* vIn, kBool* vOut, kSize count, kComparison comparison, k64f value);
590
601 kFx(kStatus) kMath_Add32s(const k32s* vIn1, const k32s* vIn2, k32s* vOut, kSize count);
602
613 kFx(kStatus) kMath_Add64f(const k64f* vIn1, const k64f* vIn2, k64f* vOut, kSize count);
614
625 kFx(kStatus) kMath_Sub32s(const k32s* vIn1, const k32s* vIn2, k32s* vOut, kSize count);
626
637 kFx(kStatus) kMath_Sub64f(const k64f* vIn1, const k64f* vIn2, k64f* vOut, kSize count);
638
649 kFx(kStatus) kMath_Mul32s(const k32s* vIn1, const k32s* vIn2, k32s* vOut, kSize count);
650
661 kFx(kStatus) kMath_Mul64f(const k64f* vIn1, const k64f* vIn2, k64f* vOut, kSize count);
662
673 kFx(kStatus) kMath_Div32s(const k32s* vIn1, const k32s* vIn2, k32s* vOut, kSize count);
674
685 kFx(kStatus) kMath_Div64f(const k64f* vIn1, const k64f* vIn2, k64f* vOut, kSize count);
686
697 kFx(kStatus) kMath_MovingAvg32s(const k32s* vIn, k32s* vOut, kSize count, kSize window);
698
709 kFx(kStatus) kMath_MovingAvg64f(const k64f* vIn, k64f* vOut, kSize count, kSize window);
710
720 kFx(kStatus) kMath_Gcd32s(k32s a, k32s b, k32s* result);
721
731 kFx(kStatus) kMath_Lcm32s(k32s a, k32s b, k32s* result);
732
740 kFx(k32s) kMath_Sign(k32s a);
741
749 kFx(k32u) kMath_Log2Ceil32u(k32u a);
750
758 kFx(k64f) kMath_Round64f(k64f a);
759
760 kEndHeader()
761
762 #include <kApi/Data/kMath.x.h>
763
764 #endif
kMath::kMath_FindMax32s
kStatus kMath_FindMax32s(const k32s *v, kSize count, kSize *index)
Finds the index of the maximum value within a numerical array.
k32u
Represents a 32-bit unsigned integer.
kMath::kMath_Average32s
kStatus kMath_Average32s(const k32s *v, kSize count, k64f *average)
Calculates the average value for a numerical array.
kMath::kMath_MulC32s
kStatus kMath_MulC32s(const k32s *vIn, k32s *vOut, kSize count, k32s value)
Multiplies each element in an input array by a constant and stores the result in an output array...
kMath::kMath_Abs64f
kStatus kMath_Abs64f(const k64f *vIn, k64f *vOut, kSize count)
Calculates the absolute value of each element in an input array and stores the result in an output ar...
kMath::kMath_FindMax64f
kStatus kMath_FindMax64f(const k64f *v, kSize count, kSize *index)
Finds the index of the maximum value within a numerical array.
kMath::kMath_MovingAvg64f
kStatus kMath_MovingAvg64f(const k64f *vIn, k64f *vOut, kSize count, kSize window)
Calculates the moving average over an input array and stores the result in an output array...
kMath::kMath_MulC64f
kStatus kMath_MulC64f(const k64f *vIn, k64f *vOut, kSize count, k64f value)
Multiplies each element in an input array by a constant and stores the result in an output array...
kMath::kMath_Sum32s
kStatus kMath_Sum32s(const k32s *v, kSize count, k64s *sum)
Calculates the sum of a numerical array.
kMath::kMath_Sum64f
kStatus kMath_Sum64f(const k64f *v, kSize count, k64f *sum)
Calculates the sum of a numerical array.
kMath::kMath_FindMax32u
kStatus kMath_FindMax32u(const k32u *v, kSize count, kSize *index)
Finds the index of the maximum value within a numerical array.
kSize
Represents an unsigned integer that can store a pointer address.
kMath::kMath_Step64f
kStatus kMath_Step64f(k64f *v, kSize count, k64f startValue, k64f increment)
Sets values in a numerical array to increment from the specified starting value.
kMath::kMath_AddC32s
kStatus kMath_AddC32s(const k32s *vIn, k32s *vOut, kSize count, k32s value)
Adds a constant to each element in an input array and stores the result in an output array...
kMath::kMath_ReplaceC64f
kStatus kMath_ReplaceC64f(const k64f *vIn, k64f *vOut, kSize count, kComparison comparison, k64f value, k64f replacement)
Compares each element in an input array with a specified value, and replaces all matching values with...
kMath::kMath_Max32u
kStatus kMath_Max32u(const k32u *v, kSize count, k32u *maxValue)
Reports the maximum value in a numerical array.
kMath::kMath_Mul64f
kStatus kMath_Mul64f(const k64f *vIn1, const k64f *vIn2, k64f *vOut, kSize count)
Multiplies the values in two input arrays and stores the result in an output array.
kMath::kMath_Sign
k32s kMath_Sign(k32s a)
Returns the sign.
kMath::kMath_Step32s
kStatus kMath_Step32s(k32s *v, kSize count, k32s startValue, k32s increment)
Sets values in a numerical array to increment from the specified starting value.
kMath::kMath_ClampC32s
kStatus kMath_ClampC32s(const k32s *vIn, k32s *vOut, kSize count, k32s minValue, k32s maxValue)
Limits each element in an input array using a minimum and maximum value.
kMath::kMath_Sub32s
kStatus kMath_Sub32s(const k32s *vIn1, const k32s *vIn2, k32s *vOut, kSize count)
Subtracts the values in two input arrays and stores the result in an output array.
kMath::kMath_Gcd32s
kStatus kMath_Gcd32s(k32s a, k32s b, k32s *result)
Returns the greatest common divisor of two integers.
kMath::kMath_FindMin32s
kStatus kMath_FindMin32s(const k32s *v, kSize count, kSize *index)
Finds the index of the minimum value within a numerical array.
kMath::kMath_Max64f
kStatus kMath_Max64f(const k64f *v, kSize count, k64f *maxValue)
Reports the maximum value in a numerical array.
kMath::kMath_DivC32s
kStatus kMath_DivC32s(const k32s *vIn, k32s *vOut, kSize count, k32s value)
Divides each element in an input array by a constant and stores the result in an output array...
kMath::kMath_CompareC64f
kStatus kMath_CompareC64f(const k64f *vIn, kBool *vOut, kSize count, kComparison comparison, k64f value)
Compares each element in an input array with a specified value and stores the results in an output ar...
kMath::kMath_Mul32s
kStatus kMath_Mul32s(const k32s *vIn1, const k32s *vIn2, k32s *vOut, kSize count)
Multiplies the values in two input arrays and stores the result in an output array.
kMath::kMath_Div32s
kStatus kMath_Div32s(const k32s *vIn1, const k32s *vIn2, k32s *vOut, kSize count)
Divides the values in two input arrays and stores the result in an output array.
kMath::kMath_FindFirst32s
kStatus kMath_FindFirst32s(const k32s *v, kSize count, kComparison comparison, k32s value, kSize *index)
Compares each value in a numerical array with a specified value and returns the index of the first ma...
kMath::kMath_Div64f
kStatus kMath_Div64f(const k64f *vIn1, const k64f *vIn2, k64f *vOut, kSize count)
Divides the values in two input arrays and stores the result in an output array.
kMath::kMath_DivC64f
kStatus kMath_DivC64f(const k64f *vIn, k64f *vOut, kSize count, k64f value)
Divides each element in an input array by a constant and stores the result in an output array...
kMath::kMath_Set32s
kStatus kMath_Set32s(k32s *v, kSize count, k32s value)
Sets all values in a numerical array to the given value.
kMath::kMath_Round64f
k64f kMath_Round64f(k64f a)
Rounds the input up to the nearest integer.
kMath::kMath_Log2Ceil32u
k32u kMath_Log2Ceil32u(k32u a)
Calculates the base-2 logarithm of the input, rounded up to the nearest integer.
kMath::kMath_Min64f
kStatus kMath_Min64f(const k64f *v, kSize count, k64f *minValue)
Reports the minimum value in a numerical array.
kMath::kMath_Min32u
kStatus kMath_Min32u(const k32u *v, kSize count, k32u *minValue)
Reports the minimum value in a numerical array.
kApiDef.h
Core Zen type declarations.
k32s
Represents a 32-bit signed integer.
kMath::kMath_SubC64f
kStatus kMath_SubC64f(const k64f *vIn, k64f *vOut, kSize count, k64f value)
Subtracts a constant from each element in an input array and stores the result in an output array...
kMath::kMath_MovingAvg32s
kStatus kMath_MovingAvg32s(const k32s *vIn, k32s *vOut, kSize count, kSize window)
Calculates the moving average over an input array and stores the result in an output array...
kMath::kMath_FindFirst64f
kStatus kMath_FindFirst64f(const k64f *v, kSize count, kComparison comparison, k64f value, kSize *index)
Compares each value in a numerical array with a specified value and returns the index of the first ma...
kMath::kMath_AddC64f
kStatus kMath_AddC64f(const k64f *vIn, k64f *vOut, kSize count, k64f value)
Adds a constant to each element in an input array and stores the result in an output array...
kMath::kMath_Stdev64f
kStatus kMath_Stdev64f(const k64f *v, kSize count, k64f *stdev)
Calculates the standard deviation for a numerical array.
kMath::kMath_Max32s
kStatus kMath_Max32s(const k32s *v, kSize count, k32s *maxValue)
Reports the maximum value in a numerical array.
kMath::kMath_ClampC64f
kStatus kMath_ClampC64f(const k64f *vIn, k64f *vOut, kSize count, k64f minValue, k64f maxValue)
Limits each element in an input array using a minimum and maximum value.
k64s
Represents a 64-bit signed integer.
kMath::kMath_Average64f
kStatus kMath_Average64f(const k64f *v, kSize count, k64f *average)
Calculates the average value for a numerical array.
kMath::kMath_Add32s
kStatus kMath_Add32s(const k32s *vIn1, const k32s *vIn2, k32s *vOut, kSize count)
Adds the values in two input arrays and stores the result in an output array.
kMath::kMath_Set64f
kStatus kMath_Set64f(k64f *v, kSize count, k64f value)
Sets all values in a numerical array to the given value.
kMath::kMath_ReplaceC32s
kStatus kMath_ReplaceC32s(const k32s *vIn, k32s *vOut, kSize count, kComparison comparison, k32s value, k32s replacement)
Compares each element in an input array with a specified value, and replaces all matching values with...
kMath::kMath_Span64f
kStatus kMath_Span64f(k64f *v, kSize count, k64f startValue, k64f endValue)
Sets values in a numerical array to step between the specified start and end values.
kObject
Root of all Zen classes.
kMath::kMath_FindLast32s
kStatus kMath_FindLast32s(const k32s *v, kSize count, kComparison comparison, k32s value, kSize *index)
Compares each value in a numerical array with a specified value and returns the index of the last mat...
kMath::kMath_Centroid64f
kStatus kMath_Centroid64f(const k64f *v, kSize count, k64f *centroid)
Calculates the center of gravity for a numerical array.
kStatus
Represents an error code.
kMath::kMath_Span32s
kStatus kMath_Span32s(k32s *v, kSize count, k32s startValue, k32s endValue)
Sets values in a numerical array to step between the specified start and end values.
kMath::kMath_Stdev32s
kStatus kMath_Stdev32s(const k32s *v, kSize count, k64f *stdev)
Calculates the standard deviation for a numerical array.
kMath::kMath_Sub64f
kStatus kMath_Sub64f(const k64f *vIn1, const k64f *vIn2, k64f *vOut, kSize count)
Subtracts the values in two input arrays and stores the result in an output array.
kMath
Collection of mathematical utility functions.
k64f
Represents a 64-bit floating-point number.
kComparison
Represents a comparison type.
kMath::kMath_Abs32s
kStatus kMath_Abs32s(const k32s *vIn, k32s *vOut, kSize count)
Calculates the absolute value of each element in an input array and stores the result in an output ar...
kMath::kMath_FindMin64f
kStatus kMath_FindMin64f(const k64f *v, kSize count, kSize *index)
Finds the index of the minimum value within a numerical array.
kBool
Represents a boolean value.
kMath::kMath_FindLast64f
kStatus kMath_FindLast64f(const k64f *v, kSize count, kComparison comparison, k64f value, kSize *index)
Compares each value in a numerical array with a specified value and returns the index of the last mat...
kMath::kMath_Lcm32s
kStatus kMath_Lcm32s(k32s a, k32s b, k32s *result)
Returns the least common multiple of two integers.
kMath::kMath_CompareC32s
kStatus kMath_CompareC32s(const k32s *vIn, kBool *vOut, kSize count, kComparison comparison, k32s value)
Compares each element in an input array with a specified value and stores the results in an output ar...
kMath::kMath_Centroid32s
kStatus kMath_Centroid32s(const k32s *v, kSize count, k64f *centroid)
Calculates the center of gravity for a numerical array.
kMath::kMath_Min32s
kStatus kMath_Min32s(const k32s *v, kSize count, k32s *minValue)
Reports the minimum value in a numerical array.
kMath::kMath_SubC32s
kStatus kMath_SubC32s(const k32s *vIn, k32s *vOut, kSize count, k32s value)
Subtracts a constant from each element in an input array and stores the result in an output array...
kMath::kMath_FindMin32u
kStatus kMath_FindMin32u(const k32u *v, kSize count, kSize *index)
Finds the index of the minimum value within a numerical array.
kMath::kMath_Add64f
kStatus kMath_Add64f(const k64f *vIn1, const k64f *vIn2, k64f *vOut, kSize count)
Adds the values in two input arrays and stores the result in an output array.