JMU
Hidden/Visible Objects in 3D
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu


Approaches
Overview
Binary Space Partitioning Algorithms
Binary Space Partitioning (cont.)
Binary Space Partitioning (cont.)
Binary Space Partitioning (cont.)

Building the Tree

  root = new Node(point[0])

  for (i = 1...N-1) {
    add(point[i], root)
  }
  
  add(Point p, Node n) {
    if (p inFrontOf n.point) {
        if (n.front == null) n.front = new Node(p)
        else                 add(p, n.front) 
    } else {
        if (n.back == null)  n.back = new Node(p)
        else                 add(p, n.back) 
    }
  }
  
Binary Space Partitioning (cont.)
Binary Space Partitioning (cont.)

Rendering using In-Order Tree Traversal

    inOrder(Node current) {
        if (current != null) {
            inOrder(current.front)

	    render(current.p)

	    inOrder(current.back)
        }
    }
    
Binary Space Partitioning (cont.)
Binary Space Partitioning (cont.)
Binary Space Partitioning (cont.)
Binary Space Partitioning (cont.)
Binary Space Partitioning (cont.)
\(z\)-Buffer Algorithms
\(z\)-Buffer (cont.)
\(z\)-Buffer Implementation Details
\(z\)-Buffer Efficiency
\(z\)-Buffer Example
\(z\)-Buffer Example (cont.)
\(z\)-Buffer Example (cont.)
\(z\)-Buffer Example (cont.)
\(z\)-Buffer Example (cont.)
\(z\)-Buffer Example (cont.)
Some Other Approaches