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#if OD_SIZEOF_LONG == 4
50 printf(
"N points: %lu Level: %hhu\n", nPoints,
level);
52 printf(
"N points: %u Level: %hhu\n", nPoints,
level);
60 OdUInt32 clstrValue =
static_cast<OdUInt32>(floor(((pow(2.0,
level) - 1) / (max[comp] - min[comp])) * (
value - min[comp]) + 0.5));
63 comp = (comp >= 2) ? 0 : comp + 1;
67#if OD_SIZEOF_LONG == 4
68 printf(
"v:%f n:%06lu ",
value, clstrValue);
70 printf(
"v:%f n:%06u ",
value, clstrValue);
74 for (
int i =
level - 1; i >= 0; --i) {
75 unsigned int bit = clstrValue >> i & 1;
95#if OD_SIZEOF_LONG == 4
96 printf(
"End compression\nBytes written: %lu\n", ++bytesCnt);
98 printf(
"End compression\nBytes written: %u\n", ++bytesCnt);
108 const bool isLog =
false)
114 printf(
"LOD Start decompression\n");
115 printf(
"EXT MIN: %f %f %f\nEXT MAX: %f %f %f\n", min[0], min[1], min[2], max[0], max[1], max[2]);
116#if OD_SIZEOF_LONG == 4
117 printf(
"N points: %lu Level: %hhu\n", nPoints,
level);
119 printf(
"N points: %u Level: %hhu\n", nPoints,
level);
123 unsigned int byte = origBuf.
getByte();
130 for (
OdUInt32 i = 0; i < nPoints * 3; ++i) {
132 for (
int j =
level - 1; j >= 0; --j) {
133 unsigned int val =
byte >> bitShift & 1;
142 if (i == nPoints * 3 - 1 && j == 0)
150 float newVal =
static_cast<float>(((max[comp] - min[comp]) / pow(2.0,
level)) *
value + min[comp]);
153#if OD_SIZEOF_LONG == 4
154 printf(
"v:%f n:%lu \t", newVal,
value);
156 printf(
"v:%f n:%u \t", newVal,
value);
161 comp = (comp >= 2) ? 0 : comp + 1;
167#if OD_SIZEOF_LONG == 4
168 printf(
"End compression\nBytes readed: %lu\n", bytesCnt);
170 printf(
"End compression\nBytes readed: %u\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)