.binvox格式解析

摘要:
.binvox格式分析。binvoxfilehasashortASCII标头,后面是二进制数据。ASCII标头//版本信息#binvox1//指定体素网格的深度、宽度和高度//网格纬度信息dim256256256//标准化变换标准化变换

.binvox格式解析

.binvox file has a short ASCII header, followed by binary data.

The ASCII header

//版本信息
#binvox 1
//specifies the depth, width, and height of the voxel grid
//grid纬度信息
dim 256 256 256
//normalization transformation 归一化变换
translate -0.0947055 0.0322891 -0.079402
scale 0.15573
data

Normalization and Mesh Correspondence

Before voxelizing, binvox normalizes the mesh such that it fits inside a 1.0×1.0×1.0 cube with its origin at (0.0, 0.0, 0.0). This is done with a translation and a uniform scale.

The unit cube is then voxelized. Three normalization transformation steps are printed to the terminal when you run binvox, e.g.:

  • bounding box: [-4.26774, -4.46283, -3.51203, 1] - [3.73801, 4.85995, 3.53327, 1]
  • normalization transform:
    • (1) translate [4.26774, 4.46283, 3.51203, 1]
    • (2) scale 0.107264
    • (3) translate [0, 0, 0]
      • Note that the third one can be ignored (it used to be relevant when normalization was not to the unit cube).

As a consequence, each voxel in the voxel model has coordinates inside the unit cube, which can be obtained as follows:

  • given a voxel at (i, j, k) (with voxel index coordinates starting at (0, 0, 0), and voxel model dimension d, these coordinates are:

    (x_n, y_n, z_n) = ((i + 0.5) / d,(j + 0.5) / d,(k + 0.5) / d)

    (the 0.5 is added to get the coordinates of the center of the voxel cell).

Next, there are two methods to compute the corresponding mesh coordinates from (x_n, y_n, z_n):

  1. first method:
    binvox now includes two extra lines in the header (which may be omitted, viewvox and thinvox don't need them):
    translate <t_x> <t_y> <t_z>
    scale <scale factor>
    First scale (x_n, y_n, z_n) by the scale factor, then translate them by (t_x, t_y, t_z)
  2. second method:
    Note the normalization transformation steps from the output of binvox, and apply these in reverse to (x_n, y_n, z_n)

Voxel ordering

The y-coordinate runs fastest, then the z-coordinate, then the x-coordinate.

To illustrate, here is the get_index function that computes the index in the 1D array of voxels of a voxel with indices (x, y, z):

int
Voxels::get_index(int x, int y, int z)
{
  int index = x * wxh + z * width + y;  // wxh = width * height = d * d
  return index;

}  // Voxels::get_index

The binary voxel data

The binary data consists of pairs of bytes.

The first byte of each pair is the value byte and is either 0 or 1 (1 signifies the presence of a voxel).

The second byte is the count byte and specifies how many times the preceding voxel value should be repeated (so obviously the minimum count is 1, and the maximum is 255).

免责声明:文章转载自《.binvox格式解析》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇HTML5的JavaScript选择器介绍es6 let下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

PowerDesigner 15 使用技巧

1.检索PowerDesigner的调色板工具栏工具&gt;自定义大小工具栏&gt;调色板检查2。在表格工具中批量修改文本格式&gt;显示首选项&gt;选择符号中的所有项目&gt;...

html,js简单保存textarea换行格式

有时我们需要在提交表单时保存html标记,但textarea不保存换行信息,因此我们需要使用js保存HTM标记,例如textarea的换行。˃˃g、 “”);这只是一个允许在js中保留HTML文本区域中的换行符和其他格式的模型。你需要开发它来满足你的需求。希望岑溪网站开发分享的内容对您有所帮助!...

Foxyproxy 火狐代理插件

Firefox上的插件Autoproxy一直很难使用。它永远不能更新规则,但foxyproxy可以替代它。用鼠标中键单击foxyproxy图标以在不同的代理方法之间切换。foxyproxy图标从foxhead变为蓝色,因为内容传输发生在网页中,该传输通过默认代理服务器,默认代理的初始颜色为蓝色。...

非线性方程(组):MATLAB内置函数 solve, vpasolve, fsolve, fzero, roots [MATLAB]

MATLAB函数求解,vpsolve,fsolve,fzero,根函数和信息概述求解函数多项式型非多项式型一维高维符号数值算法求解支持,获得所有符号解如果解可以签名,当没有符号解时获得根支持符号解方法:利用方程的性质获得标准可解函数的方法基本上是模拟手动操作vpsolve支持,获取所有数值解以获得实根支持$imes$support未知fsolve从初始值获取...

SpringBoot源码深度解析

Spring开源框架解决了企业开发的复杂性,简化了AOP的开发,IOCSpring配置越来越多,不易管理==如何自动配置Springboot,核心原则!Java领域最流行的技术!公司,如何演变结构!...

VS调试异常问题解决(一)

VisualStudio必须是"以管理员身份运行",即鼠标右键"以管理员身份运行",不是指你当前登录的账户是不是Administrator的问题。参考:VS调试时断点无法进入或命中的原因及解决方法当前不会命中断点,还没有为该文档加载任何符号参考:VS2017调试代码显示“当前无法命中断点,还没有为该文档加载任何符号”注:在mvc中视图cshtml中,如果代码...