36 const bool isLog =
false)
39 unsigned int byte = 0;
47 printf(
"LOD Start compression\n");
48 printf(
"EXT MIN: %f %f %f\nEXT MAX: %f %f %f\n", min[0], min[1], min[2], max[0], max[1], max[2]);
49 printf(
"N points: %d Level: %d\n", nPoints,
level);
56 OdUInt32 clstrValue = floor(((pow(2.0,
level) - 1) / (max[comp] - min[comp])) * (
value - min[comp]) + 0.5);
59 comp = (comp >= 2) ? 0 : comp + 1;
62 printf(
"v:%f n:%06d ",
value, clstrValue);
64 for (
int i =
level - 1; i >= 0; --i) {
65 unsigned int bit = clstrValue >> i & 1;
84 printf(
"End compression\nBytes written: %d\n", ++bytesCnt);
92 const bool isLog =
false)
98 printf(
"LOD Start decompression\n");
99 printf(
"EXT MIN: %f %f %f\nEXT MAX: %f %f %f\n", min[0], min[1], min[2], max[0], max[1], max[2]);
100 printf(
"N points: %d Level: %d\n", nPoints,
level);
103 unsigned int byte = origBuf.
getByte();
110 for (
OdUInt32 i = 0; i < nPoints * 3; ++i) {
112 for (
int j =
level - 1; j >= 0; --j) {
113 unsigned int val =
byte >> bitShift & 1;
122 if (i == nPoints * 3 - 1 && j == 0)
130 float newVal = ((max[comp] - min[comp]) / pow(2.0,
level)) *
value + min[comp];
132 printf(
"v:%f n:%d \t", newVal,
value);
135 comp = (comp >= 2) ? 0 : comp + 1;
140 printf(
"End compression\nBytes readed: %d\n", bytesCnt);
const OdGePoint3d & maxPoint() const
const OdGePoint3d & minPoint() const
virtual OdUInt8 getByte()
virtual void putByte(OdUInt8 value)
GLsizei const GLfloat * value
void decompress(const OdUInt32 &nPoints, const OdUInt8 &level, const OdGeExtents3d &ext, OdStreamBuf &origBuf, OdStreamBuf &targetBuf, const bool isLog=false)
void compress(const OdUInt32 &nPoints, const OdUInt8 &level, const OdGeExtents3d &ext, OdStreamBuf &origBuf, OdStreamBuf &targetBuf, const bool isLog=false)