【论文阅读】具有拓扑保证的Marching Cubes案例的高效实现

Efficient Implementation of Marching Cubes' Cases with Topological Guarantees

  • Abstract.
  • [1. Introduction](#1. Introduction)
    • [1.1. Marching Cubes](#1.1. Marching Cubes)
    • [1.2. Prior Work](#1.2. Prior Work)
    • [1.3. Contribution](#1.3. Contribution)
    • [1.4. Cube versus Tetrahedron](#1.4. Cube versus Tetrahedron)
  • [2. Marching Cubes with Topological Guarantees](#2. Marching Cubes with Topological Guarantees)
    • [2.1. Marching Cubes](#2.1. Marching Cubes)
    • [2.2. Correct Topology](#2.2. Correct Topology)
    • [2.3. Marching Cubes 33](#2.3. Marching Cubes 33)
  • [3. Algorithm and Implementation](#3. Algorithm and Implementation)
    • [3.1. Determining the Configuration](#3.1. Determining the Configuration)
    • [3.2. Performing the Tests](#3.2. Performing the Tests)
    • [3.3. Determining the Subcase](#3.3. Determining the Subcase)
    • [3.4 . Tiling Each Cube](#3.4 . Tiling Each Cube)
  • [4. Ambiguity Resolution](#4. Ambiguity Resolution)
    • [4.1. Resolution of Faces Ambiguities](#4.1. Resolution of Faces Ambiguities)
    • [4.2. Resolution of Internal Ambiguities](#4.2. Resolution of Internal Ambiguities)
  • [5. Tips and Tricks](#5. Tips and Tricks)

Efficient Implementation of Marching Cubes' Cases with Topological Guarantees

Abstract.

Marching Cubes methods first offered visual access to experimental and theoretical volumetric data. The implementation of this method usually relies on a small look-up table; many enhancements and optimizations of Marching Cubes still use it .However , this look-up table can lead to cracks and inconsistent topology. This paper introduces a full implementation of Chernyaev's technique to ensure a topologically correct result, i.e., a manifold mesh, for any input data.It completes the original paper for the ambiguity resolution and for the feasibility of the implementation. Moreover, the cube interpolation provided here can be used in a wider rangeof methods. The source code is available online.

Marching Cubes 方法首次提供了对实验和理论体积数据的可视化访问。这种方法的实现通常依赖于一个小的查找表;许多对 Marching Cubes 的增强和优化仍然使用它。然而,这种查找表可能导致裂缝和拓扑不一致。本文介绍了Chernyaev技术的完整实现,以确保任何输入数据都能得到拓扑正确的结果,即流形网格。此外,这里提供的立方体插值可以用于更广泛的方法。

1. Introduction

1.1. Marching Cubes

Marching Cubes has become the reference method when the sampled scalar field is structured on a cuberille grid .It classifies vertices as positive or negative, according to their comparison with a given isovalue. Then, it uses a look-up table to tile the surface inside the cube.This method has been enhanced and generalized in various directions, especially to reduce the number of cubes to be evaluated. However, most of those modern techniques still use a simple look-up table, which does not ensure the topological consistency of the result.

当采样的标量场在立方体网格上构建时,行进立方体已成为参考方法。它根据顶点与给定等值的比较将顶点分类为正或负。然后,它使用查找表拟合立方体内部的表面。该方法已在各个方向上得到增强和推广,特别是减少了要评估的立方体的数量。然而,大多数现代技术仍然使用简单的查找表,这不能保证结果的拓扑一致性。

1.2. Prior Work

略。

1.3. Contribution

In this paper, we describe an efficient and robust implementation of Chernyaev's Marching Cubes 33 algorithm [Chernyaev 95] (see Figure 1). We needed to complete Chernyaev's paper on the internal ambiguity resolution. We computed and tested the 730 subcases of the enhanced look-up table. This table can be used as is in Marching Cubes' improvements (in particular, those that avoid empty cell tests). Our result is guaranteed to be a manifold surface, with no crack, with the topology of the trilinear interpolation of the scalar field over each cube. The complete source code is available online at the address listed at the end of this paper.

在本文中,我们描述了 Chernyaev 的 Marching Cubes 33 算法的高效且稳健的实现(见图 1)。我们需要完成Chernyaev关于内部歧义解决的论文。我们计算并测试了增强型查找表的 730 个子例。该表可以按原样用于 Marching Cubes 的改进(特别是那些避免空单元测试的改进)。我们的结果保证是一个没有裂缝的流形曲面,其拓扑结构是每个立方体上的标量场的三线性插值。


Figure 1. Implicit sur face of linked tori gene ratedby the classical Marching Cubes algorithm, and ours.

图 1. 由经典的 Marching Cubes 算法和我们的算法评估的 linked tori gene 的隐式表面。

这个配图太不清晰了,通过作者开源代码重新绘制如下

图1plus1 经典 Marching Cubes 结果

图1plus2 作者改进 Marching Cubes 结果

1.4. Cube versus Tetrahedron

Another range of techniques for isosurface generation is based on tetrahedra [Treece et al. 99],as opposed to cubes.Those methods guarantee the topological consistency,and have a small look-up table. However , they have many drawbacks . They generate many more triangles, with a weaker geometrical accuracy of the result: The tetrahedra's tilings are segmented even in obvious configuration, and the vertex position cannot be adjusted to fit the geometrical trilinear approximation as we do with cubes. Moreover , the ambiguity resolution that is hidden in those methods leads to slower algorithms, which are more difficult to speed up with hardware implementation. Our technique uses a complex look-up table that only needs to be stored, which enables our algorithm to be efficiently hardware accelerated.This technique allows a topologically correct result with a single entry cubical look-up table,by a low complexity algorithm.This is a significant practical improvement compared to the former state-of-the-art of isosurface tilers [Ning,Bloomen thal 93].

等值面生成的另一系列技术是基于四面体,与立方体相反。这些方法保证了拓扑一致性,并且有一个小的查找表拟合也是分段的,并且无法像我们对立方体所做的那样调整顶点位置以适应几何三线性近似。此外,隐藏在这些方法中的歧义解析导致算法速度较慢,更难以通过硬件实现来加速。我们的技术使用仅需要存储的复杂查找表,这使得我们的算法能够有效地硬件加速。该技术允许通过低复杂度算法使用单条目立方查找表获得拓扑正确的结果。与以前最先进的等值面拟合方法相比,这是一项重大的实际改进。

2. Marching Cubes with Topological Guarantees

2.1. Marching Cubes

The Marching Cubes method produces a triangle mesh of the preimage f − 1 ( α ) f^{-1}(\alpha) f−1(α) of an isovalue a by α \alpha α scalar function f : R 3 → R f: \mathbb{R}^3\rightarrow \mathbb{R} f:R3→R We will consider α = 0 \alpha = 0 α=0 for the rest ofthe paper (considering f − α f - \alpha f−α). This scalar field is given by samples overa cuberille grid. The original method sweeps the grid, and tiles the surface cube per cube . Each vertex v v v of the cube is classified into positive and negative vertices, depending on whether f ( v ) f(v) f(v) is greater than α \alpha α or not. Thus, there are 2 8 = 256 2^8 = 256 28=256 possible configurations of a cube. The usual implementation stores those 256 in a look-up table that encodes the tiling of the cube in each case (see Figure 2).

行进立方体方法通过标量函数 f : R 3 → R f:\mathbb{R}^3\rightarrow \mathbb{R} f:R3→R 生成等值 α \alpha α 的原像 f − 1 ( α ) f^{-1}(\alpha) f−1(α) 的三角形网格。 对于本文的其余部分,我们将考虑 α = 0 \alpha = 0 α=0(考虑 f − α f - \alpha f−α)。该标量场由立方体网格上的样本给出。原始方法扫描网格,并按每个立方体拟合表面立方体。立方体的每个顶点 v v v 被分为正顶点和负顶点,具体取决于 f ( v ) f(v) f(v) 是否大于 α \alpha α 。因此,立方体有 2 8 = 256 2^8 = 256 28=256 种可能的配置。通常的实现将这 256 个数据存储在一个查找表中,该表对每种案例下立方体的拟合进行编码(参见图 2)。

Figure 2. Original Marching Cubes'look-up table.

图 2. 原始 Marching Cubes 的查找表。

2.2. Correct Topology

However, this simple algorithm can lead to cracks ,as shown in Figure 3. The same configuration can be tiled in various ways, and the 256-entry look-up table does not distinguish between those. Among the different tilings, some approximate atrilinear interpolation of the scalar field f f f over the cube.We will say a resulting mesh has the correct topology if it is homeomorphic to F − 1 ( α ) F^{-1} (\alpha) F−1(α), where F F F is equal to f f f at the sample vertices, and trilinear over each cube of the grid. This allows avoiding cracks,by applying topological tests on ambiguous faces of a cube. The same test will be done on the adjacent cube,allowing acoherent transition from one cube to the other.Nielson and Hamann [Nielson, Hamann 91] introduced the usual face test to resolvethose face ambiguities.

然而,这种简单的算法可能会导致裂缝,如图 3 所示。相同的配置可以以多种方式拟合,并且 256 项查找表不区分这些方式。在不同的案例中,标量场 f f f 在立方体上进行一些三角形近似。如果生成的网格与 F − 1 ( α ) F^{-1} (\alpha) F−1(α) 同构,我们会说生成的网格具有正确的拓扑 ,其中 F F F 等于样本顶点处的 f f f,并且在网格的每个立方体上都是三角的。通过在立方体的歧义面上应用拓扑测试,可以避免裂纹。将对相邻的立方体进行相同的测试,从而允许从一个立方体到另一个立方体的一致过渡。尼尔森和哈曼引入了通常的面片测试来解决这些面片歧义性。

Figure 3. A crack occurring on an ambiguous face in between cases 12 and 3 with the 256-look-up table.

图 3. 使用 256-查找表时,在案例 12 和案例 3 之间的歧义面上出现的裂缝。

By resolving faceambiguities ,we avoid cracks. Nevertheless, this does not guarantee the correct topology; as with the same cube configuration and the same resolution of ambiguous faces, there are topologically different trilinear interpolations (see Figure 4). Therefore, we also need to resolve internal ambiguity to guarantee the topology. The technique described in this paper guarantees thetopology by providing an extended look-up table and an enhanced analysis of each cube.

通过解决面歧义,我们可以避免裂缝。然而,这并不能保证正确的拓扑;在相同的立方体配置和相同的歧义面分辨率上,夜存在拓扑上不同的三角形案例(见图 4)。因此,我们还需要解决内部歧义以保证拓扑。本文描述的技术通过提供扩展的查找表和对每个立方体的增强分析来保证拓扑。

Figure 4. Two trilinear tilings of the sixth case, with the same resolution of faces' ambiguity.

图 4. 第六种案例的两个三角形案例,具有相同的面片歧义性分辨率。

2.3. Marching Cubes 33

Chernyaev described,with the Marching Cubes 33 [Chernyaev 95], the different possible topologies of a trilinear function over a cube. He gave a tiling for each case, adding some extra points for better geometrical approximation if necessary. He also proposed a method for resolving internal ambiguity,although it was not complete. We completed and enhanced this method,adding some tricks to avoid useless tests. We computed and tested the complete lookup table described by Chernyaev (see Figure 5).

Chernyaev 使用 Marching Cubes 33 [Chernyaev 95] 描述了立方体上三角形近似的不同可能拓扑。他对每种案例都进行了描述,并在必要时添加一些额外的点以获得更好的几何近似。他还提出了一种解决内部歧义的方法,尽管并不完整。我们完善并增强了这个方法,添加了一些技巧来避免无用的测试。我们计算并测试了 Chernyaev 描述的完整查找表(见图 5)。

Figure 5. Chernyaev's look-up table.

3. Algorithm and Implementation

The algorithm goes through the following 4 steps:
1.Determine the case number and configuration (Section 3.1.).
2.Look up which faces are to be tested based on this configuration (Section 3.2.).
3.Determine the subcase based on the result of the face tests (Section 3.3.).
4.Look up the tiling of the cube for this sub case (Section 3.4.).

该算法经过以下4个步骤:

  1. 确定案例编号和配置(第 3.1 节)。
  2. 根据此配置查找要测试哪些面(第 3.2 节)。
  3. 根据面部测试的结果确定子案例(第 3.3 节)。
  4. 查找该子案例的立方体近似(第 3.4 节)。

The simplicity of the algorithm relies on the look-up table, which is actually split into three tables:
-The case table maps each of the 256 possible configurations of a cube to one of the 15 cases of Figure 2, and to a specific number designating this configuration.
-The test table stores,for each configuration, the tests to be performed to resolve topological ambiguity.
-The tiling table stores the tiling for each configuration and subcase (there is no need for computing any geometrical transformation).

算法的简单性依赖于查找表,它实际上分为三个表:

  • 案例表将立方体的 256 种可能配置中的每一种映射到图 2 的 15 种案例之一,以及指定该配置的特定数字。
  • 测试表针对每个配置存储要执行的测试以解决拓扑歧义。
  • 近似表存储每个配置和子案例的近似(不需要计算任何几何变换)。

3.1. Determining the Configuration

The classical Marching Cubes look-up table has 256 entries (represented in Figure 2 by the 15 geometrically different cases"). Each entry represents a different vertex configuration,given that avertex is simply described by its sign (positive or negative).

经典的 Marching Cubes 查找表有 256 个条目(在图 2 中由 15 个几何上不同案例表示)。每个条目代表一个不同的顶点配置,假设顶点只是通过其符号(正或负)来描述。

Each entry is identified by an 8- bit word b b b, as for the classical Marching Cubes :Its i t h i^{th} ith bit is set to 1(respectively,0) if the i t h i^{th} ith vertex ofthe cube is positive (respectively,negative). Figure 6 details the label ofthe vertices. The case ta ble maps this 8-bit word b b b to the corresponding configuration of one ofthe 15 cases (see Fi gure 2). The configuration num bering is arbitrary.

For example, b = 129 b = 129 b=129 means t hat onlyvert ices 0 and 7 are positi ve,which i s numbe red in t he case table as t he third configuration of case 3(see Figur e7).

与经典的行进立方体一样,每个条目都由一个 8 bit 的 b b b 标识:如果立方体的 i t h i^{th} ith 顶点为正值(或负),则其 i t h i^{th} ith 位设置为 1(或 0)。图 6 详细说明了顶点的标签。案例标签将 8 bit 的 b b b 映射到 15 个案例的相应配置中(见图 2)。配置编号是任意的。

例如, b = 129 b = 129 b=129 表示只有顶点 0 和 7 是正向的,这在案例表中被编号为案例 3 的第三个配置(见图 7)。

十进制129的8位二进制为10000001

Figure 6.Labeling of vertices, edges, and faces :Vertex 0 has t he lowest x, y, z coordinates, and vertex 6 the highest .
图 6. 顶点、边和面的标记:顶点 0 具有最低的 x、y、z 坐标,顶点 6 具有最高的 x、y、z 坐标。

Figure 7. Case 3, configuration 3: two different tilings of the ambiguous face 4.

图 7. 案例 3,配置 3:歧义面 4 的两种不同近似。

3.2. Performing the Tests

To determine the topology ofthe graph of f f f inside each cube,it is not sufficient to know the signof f f f over each vertex,even when f f f is trilinear. For example, Figure 7 shows two trilinear tilings of a cube with the same sign of the vertices. When two or more adjacent vertices of a face have the same sign ,the topology of the isosurface on that face is obvious . Otherwise, this ambiguity can be resolved using the tests described in Section 4.1. When the positive vertices of a cube ar econnected by edges or through the faces, and also are the negative vertices, the topology ofthe interior of the cube is obvious. Otherwise,this ambiguity can beresolved using the method described in Section 4.2.

要确定每个立方体内部 f f f 图形的拓扑结构,只知道每个顶点上 f f f 的符号是不够的,即使 f f f 是三线性的。例如,图 7 显示了两个顶点符号相同的立方体三角形近似。当一个面的两个或多个相邻顶点符号相同时,该面的等值面拓扑结构是显而易见的。否则,可以通过第 4.1 节中描述的测试来解决这个歧义问题。当立方体的正顶点通过边或面相连,且负顶点也通过边或面相连时,立方体内部的拓扑结构也是显而易见的。否则,可以使用第 4.2 节所述的方法来解决这一歧义问题。

To know which tests are necessary to perform , a test table stores for each configuration of each ambiguous case (cases 3, 4, 6, 7,10 ,12 , and 13) the label of the faces to be tested . The interior test sometimes requires an edge code further describing the configuration, which is stored at a specific position in the tiling table (see Section 4.2. ). The labels of the edges and faces are detailed in Figure 6;face 7 stands for the interior.
For example,wit h b = 129,the third entry of the test table of case 3 is just '4' , which means that face 4 is ambiguous (there is no a djacent vertex with the same sign) and has to be tested (see Figure7).

为了知道哪些测试是必须进行的,测试表会为每个有歧义的案例(案例 3、4、6、7、10、12 和 13)的每个配置存储需要测试的面的标签。内部测试有时需要进一步描述配置的边代码,该代码存储在拟合表的特定位置(见第 4.2 节)。边和面的标签详见图 6;面 7 代表内部。

例如,当 b = 129 时,案例 3 的测试表中的第三个条目只有 "4",这意味着面 4 是歧义的(没有相同符号的相邻顶点),必须进行测试(见图 7)。

3.3. Determining the Subcase

The branching of those tests determines the subcase to be tiled (represented in Figure 5 by the 32 geometrically different cases). This branching is hard-coded for the simple cases (see Table 1). For complex cases (cases 7 and 13), other small tables are used to map the results of the tests to their corresponding subcase.
For example, with b = 129,the subcases of case 3 a redetermined by only one test,and is thus hard-coded.The cube will be tiled according to subcase 3.1 if the test is negative, and to subcase 3.2 otherwise (see Figures 5 and 7).

这些测试的分支决定了需要拟合的子案例(图 5 中的 32 个几何不同案例)。简单案例的分支是硬编码的(见表 1)。对于复杂案例(案例 7 和 13),则使用其他小表将测试结果映射到相应的子案例。

例如,当 b = 129 时,情况 3 的子案例 3.1 只由一个测试重新确定,因此是硬编码的。如果测试结果为负,立方体将根据子案例 3.1 进行拟合,否则根据子案例 3.2 进行拟合(见图 5 和图 7)。

3.4 . Tiling Each Cube

Each cube is tiled with triangles according to the tiling table. Each code of the tiling sequences identifies an edge of the cube (see Figure 6) on which a vertex of the cube's tiling will be computed. The twelfth code means interior vertex. The vertices of the final triangulation are computed by barycentric interpolations on the edges of the cube . Each group of three consecutive edge codes in thetiling table corresponds to a triangle.
For example, with b = 129, the third configuration of case 3 corresponds in the tiling table to {3,0,8,11,7,6, 7,8,6,8,0,6,3,11,6,3,6,0 }.

根据拟合表,每个立方体都用三角形拟合。拟合序列的每个代码都标识立方体的一条边(参见图 6),将在该边上计算立方体拟合的顶点。第十二个代码表示内部顶点。最终三角剖分的顶点是通过立方体边缘上的重心插值来计算的。拟合表中每组三个连续的边码对应一个三角形。

例如,当 b = 129 时,案例 3 的第三种配置在拟合表中对应于 { 3,0,8,11,7,6, 7,8,6,8,0,6,3,11,6 ,3,6,0}。

Subcase 3.1 corresponds to the first sequence of the tiling table (2 triangles) , and subcase 3.2 to the second one (4 triangles) ,as shown on Figure 7. As each tiling of the same subcase has the same number of triangles,those sequences are easily distinguished even if stored in the same table.

如图 7 所示,子案例 3.1 对应于拟合表的第一个序列(2 个三角形),子案例 3.2 对应于第二个序列(4 个三角形)。由于同一子案例的每个拟合都有相同数量的三角形,因此即使存储在同一个表格中,这些序列也很容易区分。

Table 1. A reduced representation of the test table. Case 13 has 45 entries to map the results of all the possible tests to the right subcase.

表 1. 测试表的简化表示。案例 13 共有 45 个条目,用于将所有可能的测试结果映射到正确的子案例中。

4. Ambiguity Resolution

This section describes the methods used to test the faces and interior of a cube when the values at the vertices yield an ambiguous configuration. Those tests are used in Step 2 of the algorithm, to resolve those ambiguities on a face (see Section 4.1.) or on the interior of a cube (see Section 4.2.).

本节将介绍当顶点值产生歧义的配置时,对立方体的面和内部进行测试的方法。这些测试用于算法的第 2 步,以解决面上(见第 4.1 节)或立方体内部(见第 4.2 节)的歧义问题。

4.1. Resolution of Faces Ambiguities

Face ambiguity arises when two opposite vertices A A A and C C C of the face are positive, and the two others B B B and D D D are negatives (see Figures 7 and 8). We supposed the scalar field F F F is trilinear on each cube, thus, bilinear on each face. Therefore, F − 1 ( α ) F^{-1} (\alpha) F−1(α) restricted to the face is a hyperbola (see Figure 8). Testing whether the center of the hyperbola is positive or negative (i.e., whether the positive vertices are connected inside the face) reduces (with α = 0 \alpha= 0 α=0) to testing the sign of F ( A ) ⋅ F ( C ) − F ( B ) ⋅ F ( D ) F(A)·F(C) - F(B)·F(D) F(A)⋅F(C)−F(B)⋅F(D).
The sign of the center of the hyperbola is the sign of the above expression if A A A is positive, and the opposite if A is negative. In addition, for some configuration,we want the opposite of the result. This is encoded by a negative face label in the test table.Therefore, the implemented test returns: sign( f a c e _ l a b e l ⋅ F ( A ) ⋅ ( F ( A ) ⋅ F ( C ) − F ( B ) ⋅ F ( D ) ) face\_label·F(A)·(F(A)·F(C) -F(B)·F(D)) face_label⋅F(A)⋅(F(A)⋅F(C)−F(B)⋅F(D))).

当面的两个相对顶点 A A A 和 C C C 为正值,而另外两个顶点 B B B和 D D D 为负值时,面的歧义性就产生了(见图 7 和图 8)。我们假定标量场 F F F 在每个立方体上都是三线性的,因此在每个面上都是双线性的。因此,限制在面上的 F − 1 ( α ) F^{-1} (\alpha) F−1(α) 是一个双曲线(见图 8)。测试双曲线的中心是正还是负(即正顶点是否在面内相连)可以简化为测试 F ( A ) ⋅ F ( C ) − F ( B ) ⋅ F ( D ) F(A)·F(C)-F(B)·F(D) F(A)⋅F(C)−F(B)⋅F(D) 的符号( α = 0 \alpha= 0 α=0)。

如果 A A A 为正,双曲线中心的符号就是上述表达式的符号;如果 A 为负,则相反。此外,对于某些配置,我们希望得到相反的结果。因此,实现的测试返回: s i g n ( f a c e _ l a b e l ⋅ F ( A ) ⋅ ( F ( A ) ⋅ F ( C ) − F ( B ) ⋅ F ( D ) ) ) sign(face\_label·F(A)·(F(A)·F(C)-F(B)·F(D))) sign(face_label⋅F(A)⋅(F(A)⋅F(C)−F(B)⋅F(D)))。

Figure 8.Face ambiguity test (Chernyaev's illustration)

图8.面歧义测试(Chernyaev 的插图)

4.2. Resolution of Internal Ambiguities

An internal ambiguity arises when two diagonally opposite vertices A 0 A_0 A0 and C 1 C_1 C1 of a cube can be connected through the interior of the cube, creating a kind of tunnel (see Figures 4 and 9). Let's say those two vertices A 0 A_0 A0 and C 1 C_1 C1 are positive (the description holds for negative vertices also). We first resolve face ambiguity,according to Section 4.1. If there is a chain of positive vertices joining A 0 A_0 A0 and C 1 C_1 C1 , connect ed by edges orcross ing ambiguous faces resolved as positive, then there is no internal ambiguity. Otherwise, we have to test if A 0 A_0 A0 and C 1 C_1 C1 are connected only through the cube.

Suppose A 0 A_0 A0 and C 1 C_1 C1 are connected through the interior of the cube. For X = A , B , C , D , l e t X t = t ⋅ X 0 + ( 1 − t ) ⋅ X 1 X= A ,B, C ,D, let X_t= t·X_0 + (1- t) · X_1 X=A,B,C,D,letXt=t⋅X0+(1−t)⋅X1 . As F F F is trilinear, F F F can not change sign more than once along the segment. Thus,there is a plane P = ( A t , B t , C t , D t ) P = (A_t, B_t , C_t , D_t ) P=(At,Bt,Ct,Dt), where the two edges A 0 A 1 A_0A_1 A0A1 and C 1 C 0 C_1C_0 C1C0 areconnec te d in side the square A t , B t , C t , D t A_t, B_t , C_t , D_t At,Bt,Ct,Dt (see Figure 10).For each case,we must find the direction of P P P, compute the height t t t of P P P along the edge,and resolve the ambiguity inside the square A t , B t , C t , D t A_t, B_t , C_t , D_t At,Bt,Ct,Dt .
Cases 4 and 10 have enough symmetry to always choose the same direction, independently of the configuration . The height t ∈ [ 0 , 1 ] t \in [0,1] t∈[0,1] is the solution of Chernyaev 's second order equation: a ⋅ t 2 + b ⋅ t + c a· t^2 + b· t + c a⋅t2+b⋅t+c, with:

当立方体的两个对角相对的顶点 A 0 A_0 A0 和 C 1 C_1 C1 可以通过立方体的内部连接起来,形成一种隧道时,就会产生内部歧义(见图 4 和图 9)。假设这两个顶点 A 0 A_0 A0 和 C 1 C_1 C1 都是正顶点(负顶点也是如此)。我们首先根据第 4.1 节解决面的歧义。如果存在连接 A 0 A_0 A0 和 C 1 C_1 C1 的正顶点链,并且这些正顶点链由边缘连接,或穿过被解析为正的歧义面,那么就不存在内部歧义性。否则,我们必须检验 A 0 A_0 A0 和 C 1 C_1 C1 是否只通过立方体相连。

Figure 9. Case 4,configuration 0: two different tilings of the interior of a cube.
图 9. 案例 4,配置 0:立方体内部的两种不同近似。

假设 A 0 A_0 A0 和 C 1 C_1 C1 通过立方体内部相连。对于 X = A , B , C , D ,设 X t = t − X 0 + ( 1 − t ) − X 1 X= A ,B, C ,D,设 X_t= t-X_0 + (1- t) - X_1 X=A,B,C,D,设Xt=t−X0+(1−t)−X1。由于 F F F 是三线性的, F F F 沿着线段的符号变化不会超过一次。因此,存在一个平面 P = ( A t , B t , C t , D t ) P = (A_t, B_t , C_t , D_t ) P=(At,Bt,Ct,Dt),其中两条边 A 0 A 1 A_0A_1 A0A1 和 C 1 C 0 C_1C_0 C1C0 连接在正方形 A t , B t , C t , D t A_t, B_t , C_t , D_t At,Bt,Ct,Dt 的边上(见图 10)。 对于每种情况,我们都必须找到 P P P 的方向,计算 P P P 沿边缘的高度 t t t,并解决正方形 A t , B t , C t , D t A_t, B_t , C_t , D_t At,Bt,Ct,Dt 内部的歧义问题。

Figure 10. Internal ambiguity test for cases 4 and 10 (Chernyaev's illustration).
图 10.案例 4 和 10 的内部歧义测试(Chernyaev 的插图)。

情况 4 和 10 具有足够的对称性,因此总是选择相同的方向,与配置无关。高度 t ∈ [ 0 , 1 ] t \in [0,1] t∈[0,1] 是切尔尼亚耶夫二阶方程的解: a − t 2 + b − t + c a- t^2 + b- t + c a−t2+b−t+c,其中:

For the other cases, the direction of P P P is encoded as an edge e e e inside one particular sequence of the tiling table: the seventeenth edge for cases 6,7,and 12; the second edge for the case 13.5. In that case , the height of the plane is the barycenter of the end vertices of e e e, weighted by F F F.
In both situations, the intersection of P P P with the cubeis a square, with vertices A t , B t , C t , D t A_t, B_t , C_t , D_t At,Bt,Ct,Dt . There is no ambiguity inside this square if 0 or 1 vertex ispositive (negat ive vertices are connected through the cube) ,if 3 or 4 vertices are positive(positive vertices are connected through the cube) ,or if 2 consecutive vertices are positive (no diagonal connection).In the other case , the square is ambiguous, and we resolve it in the same way as for face ambiguity.

在其他情况下, P P P 的方向被编码为拟合表中一个特定序列内的一条边 e e e:第 6、7 和 12 种情况下是第 17 条边;第 13.5 种情况下是第二条边。在这种情况下,平面的高度就是 e e e 的末端顶点的原点,并由 F F F 加权。

在这两种情况下, P P P 与立方体的交点都是一个正方形,顶点为 A t , B t , C t , D t A_t, B_t, C_t, D_t At,Bt,Ct,Dt。如果 0 或 1 个顶点为正值(负顶点通过立方体连接),3 或 4 个顶点为正值(正顶点通过立方体连接),或连续 2 个顶点为正值(无对角线连接),则该正方形内部没有歧义。

5. Tips and Tricks

The vertices of the final mesh are interpolated along an edge. To avoid computing them more than once , they can all be computed first. To store them, we used three arrays, which assign respectively to each grid vertex an eventual index to the mesh vertex on the edge parallel to the x , y x, y x,y, and z z z axis.
The normal coordinates at each grid vertex p ⃗ \vec{p} p can be computed as

最终网格的顶点是沿着一条边插值的。为了避免重复计算,可以先计算所有网格顶点。为了存储这些顶点,我们使用了三个数组,分别为每个网格顶点分配一个最终索引,指向与 x 、 y x、y x、y 和 z z z 轴平行的边缘上的网格顶点。

每个网格顶点的法线坐标 p ⃗ \vec{p} p 可以计算为

where δ ⃗ \vec{\delta} δ is the grid step along that coordinate. The normal at each point is then interpolated linearly.

其中 δ ⃗ \vec{\delta} δ 是沿该坐标的网格步长。然后对每个点的法线进行线性插值。
A low-resolution extraction can be obtained by considering a lower resolution grid,i.e. , taking into account every other vertex or every n-th vertex.
This algorithm is guaranteed to produce manifold meshes for any sample data,which allows working on previews with the same tools as on the final mesh.

低分辨率提取可以通过考虑较低分辨率的网格来获得,即,考虑每隔n个顶点取一个顶点。

该算法保证为任何样本数据生成流形网格,从而允许使用与最终网格相同的工具进行预览。
This algorithm can be used for implicit surface tiling to construct fixed precision or exact result. In the latter case ,it allows an economic use of exact arithmetic: When an evaluation of the surface inside acube is ambiguous, the cube needs to be subdivided and the implicit function is evaluated again on the subdivision cubes. The tests we provided here can be substituted to avoid subdividing cubes, guaranteeing amanifold result. For example, an exact evaluation of the contour graph of F F F gives the number of connected components inside a cube. This topological information is a powerful test to distinguish between subcases.

该算法可用于隐式表面拟合以构造固定精度或精确结果。在后一种情况下,它允许经济地使用精确算术:当立方体内部表面的评估不明确时,需要对立方体进行细分,并在细分立方体上再次评估隐式函数。我们在这里提供的测试可以替换,以避免细分立方体,保证多种结果。例如,对 F F F 等等值线图的精确评估给出了立方体内连接组件的数量。该拓扑信息是区分子案例的有力测试。


相关推荐
肥猪猪爸6 分钟前
使用卡尔曼滤波器估计pybullet中的机器人位置
数据结构·人工智能·python·算法·机器人·卡尔曼滤波·pybullet
readmancynn18 分钟前
二分基本实现
数据结构·算法
萝卜兽编程20 分钟前
优先级队列
c++·算法
盼海28 分钟前
排序算法(四)--快速排序
数据结构·算法·排序算法
一直学习永不止步43 分钟前
LeetCode题练习与总结:最长回文串--409
java·数据结构·算法·leetcode·字符串·贪心·哈希表
Rstln1 小时前
【DP】个人练习-Leetcode-2019. The Score of Students Solving Math Expression
算法·leetcode·职场和发展
芜湖_2 小时前
【山大909算法题】2014-T1
算法·c·单链表
珹洺2 小时前
C语言数据结构——详细讲解 双链表
c语言·开发语言·网络·数据结构·c++·算法·leetcode
几窗花鸢2 小时前
力扣面试经典 150(下)
数据结构·c++·算法·leetcode
.Cnn2 小时前
用邻接矩阵实现图的深度优先遍历
c语言·数据结构·算法·深度优先·图论