MCPcopy Create free account
hub / github.com/RozDavid/UnScene3D / angleBetween

Method angleBetween

utils/cpp_utils/include/vec3.h:262–269  ·  view source on GitHub ↗

returns the angle between two vectors *in degrees

Source from the content-addressed store, hash-verified

260
261 // returns the angle between two vectors *in degrees*
262 static T angleBetween(const vec3<T> &v0, const vec3<T> &v1) {
263 T l0 = v0.length();
264 T l1 = v1.length();
265 if (l0 <= 0.0f || l1 <= 0.0f)
266 return 0.0f;
267 else
268 return acosf(std::clamp(vec3<T>::dot(v0, v1) / l0 / l1, -1.0f, 1.0f)) * 180.0f / M_PI;
269 }
270
271 inline T *getData() {
272 return &array[0];

Callers

nothing calls this directly

Calls 3

dotFunction · 0.85
lengthMethod · 0.80
clampFunction · 0.70

Tested by

no test coverage detected