3.2 Data Structures
3.2.3 Enhanced Voxelmaps: Signed Distance Fields
3.2.3.3 Comparison of the Signed Distance Function V (P ) Calls
However, given that the S points stored in S are the projections of the surface voxel centers, the optimum value for δ2 is not garanteed with the implemented approach. One
possible improvement would consist in projecting the PP point on the triangle stored
in the surface voxel detected in S (see Section3.2.1, Table3.1). Yet, this enhancement decreases computation time performance and is not practicable for large amounts of points every haptic cycle.
The interpolation distance function which accesses the floating point distance values w stored in the structure W is defined as
VI(P ) = −(∇w)Td + wC, (3.28)
where d =−P C−→, as previously, wC = w(C) the floating point distance value in the voxel
where P is (by default, the value in voxel center C(P )), and ∇w = 1 s Ç wx− wC ∆X , wy− wC ∆Y , wz− wC ∆Z åT . (3.29)
As illustrated in Figure 3.6 (d), the discrete step sizes are ∆X, ∆Y, ∆Z ∈ {−1, 1}; their values are chosen depending on the octant of the voxel where P lies. The neighboring floating point distances wx, wy, wz are selected accordingly. This function VI is consid-
ered the most accurate among all three, since local linear interpolation of distances is performed for the queried point using previously generated real distance values.
3.2.3.3 Comparison of the Signed Distance Function V (P ) Calls
Figure3.7displays accuracy differences between the three signed distance function calls VL, VS, and VI; additionally, Table 3.2 summarizes all structures and calls with their
(b) (c) D
E F
Interpolation, I Interpolation, I
Surface Point, S Layers, L
Difference, I - S Difference, I - L -56.50 mm 44.59 mm 0.0 -56.50 mm 44.59 mm 0.0 (a) C
Figure 3.7: The Utah Teapot (2330 triangles) with a bounding box of 236.2 mm × 115.7 mm × 147.0 mm is voxelized with a resolution of s = 2 mm (voxel size), yielding a voxelmap of 122 × 61 × 77 voxels. (a) Surface voxel layer (red, v = 0) and first inner layer (green, v = 1) are shown. 500 × 250 pixels of the sagittal plane are rastered computing their signed distance V (P ) value. The point normal vector is the gradient of the voxelmap in its respective voxel. Distances are coded in color: warm for positive (inner) values, cold for negative (outer). Gray values denote areas where no significant data is available: The layered representation (V) was compressed to contain values around the surface only (6 inner and 4 outer layers). (b) Interpolated section (ground truth, VI), surface point map section (VS), and difference of both, which is bounded to [C, D] = [−2.80, 3.40] mm; (c) Interpolated section (ground truth, VI), layer distance section (VL), and difference of both, which is bounded to [E, F ] = [−3.19, 4.29] mm.
benchmarking experiments presented in Section 3.4. Although the results are clearly object and resolution dependent, they depict thoroughly the performance of the different calls in the voxelmap.
The differences in computation time are due to the operations performed and the amount of data accessed during each call. In the case of VL, the unique value v has to be
detected in V for a (poinsthell) point P in space. On the other hand, VS and VI require
accessing four values each: iS, Sx, Sy, Sz and wx, wy, wz, wC, respectively.
The distance field sections in Figure 3.7 were generated rasterizing for each of the voxel section 4×4 points on average. The interpolation distance function VI is considered
the ground truth. The surface point distance function VS overestimates (turquoise)
penetration values compared to VI; on the other hand, distances are underestimated
(yellow) except in the overestimation stripes that emerge in high curvature surface points. In both cases, the error is bounded to 1.7s.
The error is the biggest with layered distance function VL, as expected, but still
bounded to 2.15s. Aliasing issues, characteristic of discretized data structures, manifest clearly as alternating under- and overestimation regions. However, it is important to
Table 3.2: Summary of structures, values, and queries that are defined in primitive and enhanced voxelmaps (V). Speed and accuracy are coded with values in seven-point scala ranging from − − − (very slow/inaccurate) to + + + (very fast/accurate), being ∼ mediocre, but acceptable. All queries can be called during online interactive simulations, but those with a speed equal or less than ∼ should be used with a unique or few points every haptic cycle.
Online Calls
Sets Values Function Speed Accuracy
Primitive V V {v}iV=NV iV=1 v ∈ N VL(P ) ++ + Gradient1 S(P ) ∼ ∼ Enhanced V V {v}iV=NV iV=1 v ∈ N VL(P ) ++ + S {(S, (T1, T2, T3))}iiSS=N=1S S, T ∈ R 3 V S(P ) + ++ W {(w, iS)}iiWW=N=1W=NV w ∈ R, iS ∈ N VI(P ) ∼ + + + Gradient1 S(P ) ∼ ∼ Fast2 S(P ) ++ +
1Gradient S(P ) delivers the voxel center C of the closest surface voxel of P after performing gradient descent as defined in (3.23).
2Fast S(P ) delivers the pre-computed closest point of P accessing S.
bear in mind that the sections depict the results of one single point; in real situations, hundreds of points might collide, attenuating the aliasing effect considerably, as later discussed in Section 3.4. More importantly, the error in critical regions (voxels close to the surface) produced by VL is not much bigger than the one produced by VS, while
lighter data structures are achieved using only V. This makes the primitive voxelmaps very useful structures for large objects or situations in which the computational speed and memory space have priority over accuracy.
As mentioned, Section 3.4 provides more results related to the different signed dis- tance function calls. Among others, the effect of different voxelmap resolution is analyzed.
3.2.4 Enhanced Pointshells: Point-Sphere Trees
The primitive pointshell or point cloud described in Section 3.2.1 is a list of unordered 6D points that represent the original mesh. This data structure is enhanced to obtain the enhanced pointshell, which encodes multiresolution point neighborhood information. That improvement is performed as follows:
(i) The set of points P defined in (3.6) is extended to contain a quality value q for each point related to the curvature; the updated set of 7D points is
P = {(P, n, q)1, . . . , (P, n, q)i, . . . , (P, n, q)NP} = {(P, n, q)i} NP
i=1. (3.30)
(ii) A set C of NC elements or clusters c is defined:
C = {c1, . . . , ci, . . . , cNC} = {ci} NC
i=1. (3.31)
This set contains the information with which points are hierarchically organized in levels or subsets that sample the object completely with different resolutions or point densities. Additionally, a sphere tree is built upon the point hierarchy in order to detect faster relevant regions during realtime calls. The elementary unit in C, the cluster c, represents a surface patch on the object and which is sampled by points and it is defined as
c =
Ç
L, K, (R, X), {&(P, n, q)j}, {&ccj}, &cp, qmax
å
, (3.32)
where
– L is the level where the cluster is, being the highest level L = 1 and the level of the leaves L = NL;
– K is the number of cluster points, which satisfies 1 ≤ K ≤ NK, with NK
being the branching factor in the tree (NK = 4 default);
– (R, X) are the radius R and the center X of the minimally bounding sphere that contains all children points recursively branched until the leaf level; – {&(P, n, q)j}Kj=1 are the memory addresses of the K cluster points, with Pj=1
being the cluster parent point which represents the whole cluster; the addresses point to elements in P;
– {&cc
j}Kj=1are the addresses of the K children clusters associated to the cluster
points; note that each children cluster recursively contains addresses of other cluster points and children clusters; the addresses point to elements in C; – &cp is the address of the parent cluster in C;
– and qmax is the maximum quality value of all points that are recursively
branched from the cluster until the leaf level.
In close relationship to C, the FIFO (First in First Out) queue or set of clusters Q is additionally defined. This is not an intrinsic structure of the pointshell P, but it supports
ni Ci Cj Ck nj nk ∆Cij ∆nij ∆Cik ∆nik
min0.0 0.267avg 0.632max min0.0 0.271avg 0.597max
(a) (b) (c)
Figure 3.8: Point quality values q (m−1) related to the curvature: (a) The quality value q
i of a
point Pi is computed observing the variation of the normal vector (∆nij) in the surrounding voxel centers (Cj) within the neighborhood of the point NV,2(Pi). (b) Pointshell representation of the Stanford Bunny with a bounding volume of 105 mm × 206 mm × 160 mm: 5584 points are created using a voxel size s = 4 mm. Normal vectors are flipped to point outwards and coded in color (yellow to red) according to the quality value q of the point. (c) Poinsthell representation of a cube with 2000 mm edge length: 9602 points are created using a voxel size s = 50 mm. Normal vectors are again flipped and coded in color according to q.
the ordered access to clusters during realtime calls: Q = {ci}NQ
i=1, Q ⊆ C (3.33)
At the beginning of each proximity or collision query, this queue is empty, Q ← ∅; during the query, it is filled with clusters that are detected to be likely colliding and emptied step by step again by the end of the haptic cycle. This section presents how P and C are created, whereas Section 3.3 explains in greater detail how Q is defined and used for collision checks between complex geometries.
The input structures necessary to build the point-sphere tree are the primitive data structures of the object introduced in Section3.2.1.