CPSC 212
(Data Structures and Algorithms)

Phase 3: Signed Distance Function

Due date:
11/28/06

Objectives:

Given a set of consistently oriented tangent planes at each input point, Tp(xi), each consisting of: calculate the signed distance function f(p) at each point p situated at the vertex of a cube in a 3D cube lattice, where f(p) is defined as the signed distance between point p and its projection z onto Tp(xi): f(p) = (p - oi) ⋅ ni.

conics.15887.pts
Figure 1: consistent Tp(xi).n
(binheap)
Figure 2: f(p) at
marching cube verteces
mechpart.4102.pts
Figure 3: consistent Tp(xi).n
(binheap)
Figure 4: f(p) at
marching cube verteces

Description:
  1. Construct and iterate through a (virtual) 3D grid within the given object's bounding box, incrementing by some small amount, e.g., Δ = 0.01 for mechpart, Δ = 0.21 for conics. Note that for f×r×c cubes, there'll be (f+1)×(r+1)×(c+1) verteces.
  2. For each vertex point pi:
    • Find the cloud point nearest to the vertex.
    • Obtain the nearest neighbor point's tangent plane, Tp(xi) (which should be stored in the nearest neighbor point's data structure as a pointer to a tangent plane object).
    • Obtain the tangent plane's center, oi.
    • Obtain the tangent plane's normal, ni.
    • Compute f(pi) = (pi - oi) ⋅ ni.
    • Compute zi = oi - f(pi) ni.
    • Compute the Euclidean distance between zi and its nearest cloud point. If this distance is greater than rho, consider f(pi) undefined.
    • Store f(pi).
  3. You now should have a list of verteces with the signed distance function f(p) value at each vertex. This is referred to as the field data.
  4. Output your field data to a plain text file in the following format:
    cube[0].p0 f(cube[0].p0)
    cube[0].p1 f(cube[0].p1)
    cube[0].p2 f(cube[0].p2)
    cube[0].p3 f(cube[0].p3)
    cube[0].p4 f(cube[0].p4)
    cube[0].p5 f(cube[0].p5)
    cube[0].p6 f(cube[0].p6)
    cube[0].p7 f(cube[0].p7)
    ...
    cube[n-1].p0 f(cube[n-1].p0)
    cube[n-1].p1 f(cube[n-1].p1)
    cube[n-1].p2 f(cube[n-1].p2)
    cube[n-1].p3 f(cube[n-1].p3)
    cube[n-1].p4 f(cube[n-1].p4)
    cube[n-1].p5 f(cube[n-1].p5)
    cube[n-1].p6 f(cube[n-1].p6)
    cube[n-1].p7 f(cube[n-1].p7)
    where each of the cube's verteces, cube[i].pj is a 3D point and f(cube[i].pj) is the point's signed distance (a float).
  5. Sample output can be found here: conics.15887.field, mechpart.4102.field.
  6. You can view your output with the kdtree program. Load your field file to view it. You can then check the "field" checkbox in the View menu to see the signed distance at each vertex. The program was last compiled on a Linux PC running Fedora Core 3 with g++ v3.4.3 and so should run on most of the FX net Linux boxes (but not on the Suns).
    Usage:
    • left mouse: move camera in xy-plane (up/down, left/right)
    • scroll mouse: truck in and out (along camera's view-axis)
    • CTRL-left mouse: yaw/pitch camera
    • CTRL-scroll mouse: roll camera
What to hand in:
Code "tarball" (e.g., phase3.tar.gz) including:
  1. README file containing assignment and solution descriptions, e.g., program design, description of algorithm, etc., if appropriate.
  2. INSTALL file containing any specific compliation quirks peculiar to your program, e.g.,
    Compilation: make.
  3. USAGE file containing any specific usage quirks peculiar to your program, e.g.,
    Usage: ./phase3 < conics.15887.pts where ./phase3 is the executable and conics.15887.pts is the input.
  4. src/ directory with source code.