mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 16:55:07 +02:00
add method to return the start vertex for an octal code
This commit is contained in:
parent
f8f098cf2c
commit
adb45c825b
2 changed files with 15 additions and 0 deletions
|
@ -102,3 +102,17 @@ unsigned char * childOctalCode(unsigned char * parentOctalCode, char childNumber
|
|||
|
||||
return newCode;
|
||||
}
|
||||
|
||||
float * firstVertexForCode(unsigned char * octalCode) {
|
||||
float * firstVertex = new float[3];
|
||||
memset(firstVertex, 0, 3 * sizeof(float));
|
||||
|
||||
for (int i = 0; i < numberOfThreeBitSectionsInCode(octalCode); i++) {
|
||||
int8_t sectionIndex = sectionValue(octalCode + 1 + (3 * i / 8), (3 * i) % 8);
|
||||
for (int j = 0; j < 3; j++) {
|
||||
firstVertex[j] += 0.5 * (int)oneAtBit(sectionIndex, 7 -j);
|
||||
}
|
||||
}
|
||||
|
||||
return firstVertex;
|
||||
}
|
||||
|
|
|
@ -16,5 +16,6 @@ int bytesRequiredForCodeLength(unsigned char threeBitCodes);
|
|||
bool isDirectParentOfChild(unsigned char *parentOctalCode, unsigned char * childOctalCode);
|
||||
char branchIndexWithDescendant(unsigned char * ancestorOctalCode, unsigned char * descendantOctalCode);
|
||||
unsigned char * childOctalCode(unsigned char * parentOctalCode, char childNumber);
|
||||
float * firstVertexForCode(unsigned char * octalCode);
|
||||
|
||||
#endif /* defined(__hifi__OctalCode__) */
|
||||
|
|
Loading…
Reference in a new issue