Back to November Calendar            ←Previous Entry                             Next Entry→

November 21, 2005

Spline Representations XIII

 

An Example  a Hildebrand Blob

 

How about an example?  What I have in mind are 6 points: 4 on the circumference of the unit circle at

A(1,0),     C(0.707107, 0.707107),       D(0, 1)       F(0.707107, 0.707107)

and the 2 points

B(1+tan(π/8), tan(π/8)+ tan2(π/8))       and      E(tan(π/8)+ tan2(π/8), 1tan(π/8))

on the circles with tangents y = 0, y = x at A and C and x = 0, y = x at D and F, respectively.

 

I start by creating a single matrix representing the x-coordinates of the knots in the first row and the y-coordinates in the second row.  Note that, as it happens, .

 

>> knots = [1 1+tan(pi/8) sqrt(2)/2 0 tan(pi/8)*(1+tan(pi/8)) sqrt(2)/2; 0 tan(pi/8)*(1+tan(pi/8)) sqrt(2)/2 -1 -1-tan(pi/8) -sqrt(2)/2]

knots =

    1.0000    1.4142    0.7071         0    0.5858    0.7071

         0    0.5858    0.7071   -1.0000   -1.4142   -0.7071

 

Now, this may seem a bit of a kluge, but what I did was use modular arithmetic to compute the indices, so I didn’t have to consider the first and last curves which otherwise would have indices out of range.  Thus 1+mod(k+2,6) is always 1,2,3,4,5 or 6, and will give us the right index relative to k+1, k and k-1. In MatLab, the kth row of xp is denoted xp(k,:) and will contain the coefficients of cubic polynomial for the x-coordinate parameterization of the kth leg of the curve according to the formula in 1.8. 

 

>> for k = 0:5
      xp(k,:)=[(knots(1,1+mod(k+2,6))- 3*knots(1,1+mod(k+1,6))            
                +3*knots(1,1+mod(k,6))-knots(1,1+mod(k-1,6)))/2,
                -(knots(1,1+mod(k+2,6))-4*knots(1,1+mod(k+1,6))
                +5*knots(1,1+mod(k,6))-2*knots(1,1+mod(k-1,6)))/2,
                (knots(1,1+mod(k+1,6))-knots(1,1+mod(k-1,6)))/2,
                 knots(1,1+mod(k,6))];
   end;

 

Similarly, we define the coefficient matrix of yp cubics, where each of 6 rows contains the 4 coefficients for the cubic function of y-coordinate function of the kth parameterization:

 

>> for k = 0:5
      yp(k,:)=[(knots(2,1+mod(k+2,6))- 3*knots(2,1+mod(k+1,6))            
                +3*knots(2,1+mod(k,6))-knots(2,1+mod(k-1,6)))/2,
                -(knots(2,1+mod(k+2,6))-4*knots(2,1+mod(k+1,6))
                +5*knots(2,1+mod(k,6))-2*knots(2,1+mod(k-1,6)))/2,
                (knots(2,1+mod(k+1,6))-knots(2,1+mod(k-1,6)))/2,
                 knots(2,1+mod(k,6))];
   end;

 

Having set it up this way, we can establish a domain for each parameterization,

 

>>t=0:.05:1;

 

and pull off the plot like so:

 

>> for i=1:6 plot(polyval(xp(i,:),t),polyval(yp(i,:),t)); end;

 

I also want to see the circle and knots, which I accomplish with these commands:

 

>> plot(knots(1,:),knots(2,:),'or')

>> plot(cos(6.283185.*t),sin(6.283185.*t))

 

 

Observations:

                             

At a knot, we have

 which shows that the derivative function is continuous (it’s the same at the t=1 endpoint of the previous piece as it is at the t=0 endpoint of the current piece) and the slope of the tangent line is the slope of the secant line connecting the knots immediately before and after the current knot.

 

While it would be nice to parameterize by arclength, since the “speed” we move around the curve with any parameterization is , the speed is continuous, so you don’t get a weird jerk going through a knot.

 

The curves defined by 1.1 and 1.2 define an oblique parabola.  To see this, eliminate t2 from the pair of equations in 1.1 like so:

                                            

Solve for t:

                                                     

and plug back into x(t) in 1.1 to get

                       

Subtracting a0 from both sides and clearing denominators, we get

        

Right, well, it’s here that Hildebrand loses me.  I may come back to this, but for now, I’ll just summarize his claims that I haven’t verified.  He says that you get an equation of the form

                                

where B2  4AC = 0, unless a1b2  b1a2 = 0, in which it’s linear:

                                                    

 

 

Exercises:

  1. Write an m-file that will take a coefficient set and output the shifted coefficient set.
  2. What’s a good way to get the reflection of a Hildebrand curve in (a) the y-axis (b) the x-axis or (c) the line y=x.?
  3. Show that the second derivative is not necessarily continuous at a knot.