- Exam: April 16th, 2008, 09.00, RCH???

What is a polyhedron?

- A set of vertices
- Connected by edges
- Which define faces

Ray Tracer format

- Array of points: three floating point numbers
- Array of edges: pair of pointers to vertices
- Array of faces: pointers to the vertices at the corners
- Build the arrays as you read the input.

Now let's think about modifying the mesh.

- Add a vertex, given its coordinates
- Easy

Is this vertex already in the data structure?

- Hmmm?

Keep the vertices sorted by location

- Delete a vertex, including edges and faces
- Leave them dangling?
- You had better not do much deleting

Finding the edges and faces is not easy

- Add pointers from vertices to edges and faces

What about the hole in the vertex array?

- Add an edge, given two vertices
- Easy

Is the edge already in the data structure?

- How would you find out?

- Delete an edge, including possible faces and disconnected points.
- Edge is easy
- Finding vertices is easy.
- Are they disconnected

Are any faces affected?

- Split a face with a new vertex, given face, vertex
- Adding the vertex is easy
- Adding edges is easy
- Adding faces is easy

Delete the old face

- Idea. Overwrite the old face with one of the new ones

In summary we have,

- Each vertex has pointers to two edges
- Each vertex has pointers to n faces
- Each edge has pointers to two faces

When we talk about polyhedra & meshes it seems most natural to talk about vertices

- edges are vertex pairs,
- faces are vertex n-tuples n>2.

And we have been most interested in vertices and faces. Meshes are, of course, graphs

- not just any graphs but ones that obey constraints
- for every constraint there is an invariant
- complete sets of invariants are not known: not for lack of trying to find them

Every time we see a graph we should think,

- "What about its dual?"

In the dual edges are primary:

- vertices are where edges meet,
- faces are minimal closed paths

Winged edge data structure

- Where does the name come from?

Each edge has

- pointers to the faces it separates
- pointers to the vertices at its ends
- participates in a doubly linked list of edges at each of its ends

Each vertx has

- one pointer to an edge
- Exercise. Why do you only need one?

Each face has

- one pointer to an edge
- Exercise. Why do you only need one?

Issues to consider

- Traversal. Can you find all neighbours quickly?
- Vertex/edge addition. Can you do it in constant time?
- Vertex/edge deletion. Can you do it in constant time?

Quite simple, really

- Parameters of the model are functions of time.
- parameters of moving objects
- parameters of camera, including things like depth of field

- The modeller (or the interface) must specify these functions.
- Constraints.
- The functions must be physically `realistic'.
- The functions must be easily specifiable.

`Specifiable': Think splines.

`Realistic': Think continuity.

- C0 continuity: no teleportation, possible discontinuities in velocity, which violate Newtonian mechanics.
- C1 continuity: no discontinuities in velocity, possible infinite accelarations.
- C2 continuitiy: acceleration continuous, possible infinite jerks.
- etc.

- Between camera and actors

As type of actor changes: compare classic Disney animation to live action, which obeys Newtonian dynamics (and other constraints, too)

- Line segments
- Two points
- P^1_0(t, u) = uP0 + tP1
- For this to be affine we need u + t = 1

- Quadratic segments
- Three points
- P^1_0(t, u) = uP0 + tP1; P^1_1(t, u) = uP1 + tP2
- P^2_0(t, u) = uP^1_0(t, u) + tP^1_1(t, u) = u^2 P0 + 2ut P1 + t^2 P2
- Notice derivatives at end points are not independent

- Cubic segments
- Four points
- P^3_0(t, u) = t^3 P0 + 3t^2 u P1 + 3 t u^2 P2 + u^3 P3
- Now the derivatives at the end points are independent

- etc

This process is called `blending' points.

If we call comb(n,i)u^(n-i) t^i the Bernstein polynomial, B(n, i; t, u), then

- The n'th degree segment is
- sum_i B(n, i; t, u) Pi is the blend

- This is a Bezier curve of degree n.
- Pi: i = 0,...,n are the control points.
- Note. n is not the dimension of the space in which you are working.
- Useful fact:
- sum_i B(n, i; t, u) = (t + u)^n = 1.
- The sum in the blend is necessarily affine (Why is this important?)
- This should remind us strongly of all the stuff we know about binomials: Pascal's triangle and all that.

With C0 continuity

- Q0 = P3
- Interface
- Place P0, P1, P2, P3
- Q0 is determined; place Q1, Q2, Q3
- R0 is determined; place R1, R2, R3
- etc.

With C1 continuity

- Q0 = P3
- Q1 - Q0 = P3 - P2, or Q1 = 2 P3 - P2
- Interface
- Place P0, P1, P2, P3
- Q0, Q1 are determined; place Q2, Q3
- R0, R1 are determined; place R2, R3
- etc.

Weaker first order continuity G1

- Q0 = P3
- Q1 - Q0 = a(P3 - P2), or Q1 = (a+1) P3 - a P2 a > 0 (Why?)
- Interface
- Place P0, P1, P2, P3
- Q0 is determined; choose a, place Q2, Q3
- R0 is determined; choose b, place R2, R3
- etc.

With C2 continuity

- Q0 = P3
- Q1 - Q0 = P3 - P2, or Q1 = 2 P3 - P2
- Q2 = linear combination of P1, P2, P3 (Calculation an exercise for the reader.)

Interface

- Place P0, P1, P2, P3
- Q0, Q1, Q2 are determined, place Q3

etc.