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

Function CalcDistance

source/userdata.cpp:605–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

603
604template<typename T>
605T CalcDistance(UserData* pUserData, UserData* pOther) {
606 T sum = T();
607 i32 bufSize = pUserData->width * pUserData->height;
608 for (i32 i = 0; i < bufSize; i++) {
609 T* pData = (T*)pUserData->pData;
610 T* pOtherData = (T*)pOther->pData;
611 T diff = pOtherData[i] - pData[i];
612 sum += diff*diff;
613 }
614 return (T)sqrtf((f32)sum);
615}
616
617// ***********************************************************************
618

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected