我已经在C#中实现了行进立方体,双行进立方体和自适应行进立方体,但却发现我需要双重轮廓以达到我的目的.我已经阅读了关于双轮廓的所有作品,除了双轮廓本身的核心之外,我得到的只是:最小化二次误差函数(QEF).
现在,我只是通过找到共享该单个顶点(3到6个边)的所有edgePoints之间的平均值来计算内部体素的顶点位置,并且它运行良好,但它显然不会在正确的位置创建内部顶点.
这是我要创建的代码片段.任何帮助将非常感激
/// <summary>
/// ORIGINAL WORK: Dual Contouring of Hermite Data by Tao Ju (remember me of a MechCommander 2 character)
/// 2.3 Representing and minimizing QEFs
/// The function E[x] can be expressed as the inner
/// product (Ax-b)T (Ax-b) where A is a matrix whose rows are the
/// normals ni and b is a vector whose entries are ni*pi. <------------ (dot product?)>
/// Typically, the quadratic function E[x] is expanded into the form
/// E[x] …Run Code Online (Sandbox Code Playgroud) quadratic marching-cubes matrix-multiplication least-squares
我刚刚完成了这些用于双行进立方体的桌子(由尼尔森制作)。VerticesNumberTable 包含为每个体素创建的顶点数组的长度(1 到 4 个内部顶点),而 EdgesTable 用于将这些顶点中的每一个分配给体素的右边缘,以便使用它们来计算内部顶点位置和正常。Edgetable 的工作原理有点像 triTable,用于原始的移动立方体算法。每组边与下一组边之间用 -1 分隔。该列表以-2 结束,因此该值可用于打破循环。
#region EdgesTable
public static int[,] EdgesTable = new int[256, 16]
{
{-2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 8, 3, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{0, 1, 9, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
{1, 3, 8, 9, -2, -1, -1, -1, -1, …Run Code Online (Sandbox Code Playgroud)