MCPcopy Create free account
hub / github.com/android/ndk-samples / Approach

Function Approach

endless-tunnel/app/src/main/cpp/util.hpp:67–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65// 60.
66template <typename T>
67T Approach(T orig, T target, T amount) {
68 float absDiff = orig - target;
69 if (absDiff < static_cast<T>(0)) absDiff = -absDiff;
70 if (absDiff < amount) {
71 return target;
72 } else if (target > orig) {
73 return orig + amount;
74 } else {
75 return orig - amount;
76 }
77}
78
79template <typename T>
80T Abs(T f) {

Callers 1

DoFrameMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected