Notes for Thursday April 5:
Bsplines Splines and Mesh Normals

 

Bsplines

Bsplines are a way to create a very smooth non-interpolating spline. "Non-interpolating" means that the spline itself does not pass through the guide points.

It is created by successive convolutions, where B0 is a pulse, and B3 is the final Bspline spread function:

For any unit width segment, the value within that segment is a cubic function which is the sum of four cubic functions, each a different part of B3:

A(4th part)(1-t)3 / 6
B(3rd part) t3/2 - t2 + 2/3
C(2nd part)-t3 + t2/2 + t/2 - 1/6
D(1st part) t3 / 6

We can rewrite these four cubic functions as the Bspline Matrix:

a
b
c
d
 ⇐  -1/6
 3/6
-3/6
 1/6
-3/6
-6/6
0  
 4/6
-3/6
 3/6
 3/6
 4/6
 1/6
0  
0  
0  
 ×  A
B
C
D

 

Computing mesh normals

If you create a general parametric surface mesh, there might not be an easy formula to compute a surface normal at each vertex. In such cases, there is a method you can use to compute the vertex normals.

It proceeds in two steps:

  1. Compute a faceNormal for each face of the mesh.

  2. Use those faceNormals to compute the vertex normals.

To do step (1) above, you need to sum up the cross products of each pair of neighboring edges in the face:

For an N sided face:

   faceNormal = [0,0,0]
   for (i = 0 ; i < N ; i++) {
      a = v[i+1 mod N) - v[i]
      b = v[i+2 mod N) - v[i+1 mod N]
      faceNormal += cross(a, b)
   }

To do step (2) above, just sum up the faceNormals for all faces that meet at that vertex, and then normalize.