MCPcopy Create free account
hub / github.com/DavidColson/Polybox / CalcMagnitude

Function CalcMagnitude

source/userdata.cpp:577–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575
576template<typename T>
577T CalcMagnitude(UserData* pUserData) {
578 T sum = T();
579 i32 bufSize = pUserData->width * pUserData->height;
580 for (i32 i = 0; i < bufSize; i++) {
581 T* pData = (T*)pUserData->pData;
582 T elem = pData[i];
583 sum += elem*elem;
584 }
585 return (T)sqrtf((f32)sum);
586}
587
588// ***********************************************************************
589

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected