67 (box[1] + box[4]) / 2,
68 (box[2] + box[5]) / 2};
74 else if (
y < halfBox[1])
76 else if (
x < halfBox[0])
81 else if (
y > halfBox[1])
83 else if (
x > halfBox[0])
91 if (sector != 3) psnorm = box[sector];
96 box[3 + sector] = box[sector];
102 if (sector != 3) psnorm = box[3 + sector];
107 box[sector] = box[3 + sector];
108 box[3 + sector] = psnorm;
121 unsigned char level ) {
126 n[0] = n[1] = n[2] = 0;
134 unsigned char l_shift = level * 2;
135 for (
unsigned char k = 0; k < level; ++k) {
137 const unsigned sector = ((index >> l_shift) & 3);
140 box[0] = (box[0] + box[3]) / 2;
141 box[1] = (box[1] + box[4]) / 2;
142 box[2] = (box[2] + box[5]) / 2;
144 box[3 + sector] = box[sector];
152 box[3] = (box[0] + box[3]) / 2;
153 box[4] = (box[1] + box[4]) / 2;
154 box[5] = (box[2] + box[5]) / 2;
157 box[sector] = box[3 + sector];
158 box[3 + sector] = tmp;
166 const unsigned sector = index >> (level + level);
168 n[0] = ((sector & 4) != 0 ? -(box[3] + box[0]) : box[3] + box[0]);
169 n[1] = ((sector & 2) != 0 ? -(box[4] + box[1]) : box[4] + box[1]);
170 n[2] = ((sector & 1) != 0 ? -(box[5] + box[2]) : box[5] + box[2]);
float PointCoordinateType
Type of the coordinates of a (N-D) point.
static const unsigned char QUANTIZE_LEVEL
Compressed normals quantization level (number of directions: 2^(2*N+3))
static const unsigned NULL_NORM_CODE
Null normal code.
static unsigned Compress(const PointCoordinateType N[3])
Compression algorithm.
static void Decompress(unsigned index, PointCoordinateType N[3], unsigned char level=QUANTIZE_LEVEL)
Decompression algorithm.
static void InvertNormal(CompressedNormType &code)
Inverts a (compressed) normal.
unsigned int CompressedNormType
Compressed normals type.