本文整理汇总了C++中Octree::set方法的典型用法代码示例。如果您正苦于以下问题:C++ Octree::set方法的具体用法?C++ Octree::set怎么用?C++ Octree::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Octree
的用法示例。
在下文中一共展示了Octree::set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ct_to_octree
Octree ct_to_octree(const char* path, int resolution, int z_offset = 84){
Octree octree;
octree.resolution = resolution;
const char* filepath = "./textures/ct.raw";
short int buffer;
FILE* file = fopen(filepath, "rb");
fseek(file, 0L, SEEK_END);
int size = ftell(file) / sizeof(buffer);
fseek(file, 0L, SEEK_SET);
printf("size:%d\n", size);
int x = 0;
int y = 0;
int z = z_offset;
for (int i = 0; i < size; i += 1){
fread((void*)(&buffer), sizeof(buffer), 1, file);
if (buffer > 300 && y < 340){
float value = log(float(buffer)) / 8.0;
float color[4] = {value, value, value, 1.0};
octree.set(x,y,z,color);
octree.set(x,y, z + 1,color);
}
x += 1;
if (x > 511){
x = 0;
y += 1;
}
if (y > 511){
y = 0;
z += 2;
}
//printf("buffer: %d\n", buffer);
}
fclose(file);
return octree;
}