Results 1 to 6 of 6

Thread: xxx

  1. #1

    Thread Starter
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    xxx

    Parametric Cubic Spline continued...

    As a final example, let’s see if a circle can be approximated with the same four points (i.e. 4 spline segments). The connection sequence needed is:

    Code:
    ┌		┐ ┌       ┐          ┌                        ┐      ┌      ┐
    │2  1  .  1   2	│ │x1" y1"│          │x2-x1-x5+x4  y2-y1-y5+y4│      │-2   0│
    │1  4  1  .   .	│ │x2" y2"│ = 6/(h*h)│  x3-2x2+x1    y3-2y2+y1│      │ 0  -2│
    │.  1  4  1   .	│ │x3" y3"│          │  x4-2x3+x2    y4-xy3+y2│ = 96 │ 2   0│
    │.  .  1  4   1	│ │x4" y4"│          │  x5-2x4+x3    y5-2y4+y3│      │ 0   2│
    │1  .  .  .  -1	│ │x5" y5"│          │          0            0│      │ 0   0│
    └   		┘ └       ┘          └                        ┘      └      ┘
    Code:
    ┌				┐ ┌       ┐    ┌                                            ┐
    │ ?                  		│ │x1" y1"│    │             ?                  ?           │
    │h1   2(h1+h2)      h2		│ │x2" y2"│ = 6│(x3-x2)/h2-(x2-x1)/h1  (y3-y2)/h2-(y2-y1)/h1│
    │        h2      2(h2+h3)  h3	│ │x3" y2"│    │(x4-x3)/h2-(x3-x2)/h1  (y4-y3)/h2-(y3-y2)/h1│
    │                           ?  	│ │x4" y3"│    │             ?                  ?           │
    └   				┘ └       ┘    └                                            ┘
    Code:
    ┌				┐ ┌       ┐    ┌               ┐
    │1                  		│ │x1" y1"│    │ 0        1    │
    │0.369   1.261   0.261		│ │x2" y2"│ = 6│ 9.243    3.828│
    │        0.261   1.261   0.369	│ │x3" y2"│    │-3.828   -9.243│
    │                        1  	│ │x4" y3"│    │ 0        1    │
    └   				┘ └       ┘    └               ┘
    p1 = [1,0]
    p2 = [0,1]
    p3 = [-1,0]
    p4 = [0,-1]
    p5 = [1,0]

    Point p5, which is identical to p1, is needed to close the shape. Thus, n = 5. The values of s are easy – since the points are all equidistant, by inspection: s = [0, 0.25, 0.5, 0.75, 1]T.

    Boundary conditions require special consideration. In the case of a closed loop, the 1st and last points are joined, which makes them interior points subject to the same 1st and 2nd derivative compatibility constraints as the other interior points. Thus, with closed loops, there are no choices to be made for boundary conditions! To derive the 1st derivative compatibility equation, simply equate 1st derivatives of p1 and p5:

    p1' = p5'
    p1' = (p2 – p1)/h1 - p2"h1/6 - p1"h1/3 = p5' = (p5 – p4)/h4 + p5"h4/3 + p4"h4/6
    6(p2 – p1)/h1 - p2"h1 – 2p1"h1 = 6(p5 – p4)/h4 + 2p5"h4 + p4"h4
    6[(p2 – p1)/h1 - (p5 – p4)/h4] = p2"h1 + 2p1"h1 + 2p5"h4 + p4"h4

    The 2nd derivative boundary conditions are easy: p1" - p5" = 0. (Note: using p just means there are 2 sets of equations, one for x and another for y). Also, h1 = h2 = h3 = h4 = h = s2 = 0.25, which allows the use of the simplified equations. The resulting matrix equation to be solved is:

    Code:
    Matrix Equation
    The solution is x" = [-48, 0, 48, 0, -48]T and y" = [0, -48, 0, 48, 0]T, from which we can calculate the coefficients of the spline segments and generate the plot using s = 0 to 1. It is a remarkable fit considering only 4 spline segments were used. Clearly, more points will result in an even better fit.

    Conclusion:

    We have extended our knowledge of cubic splines to include the powerful and flexible parametric version and have fit various shapes (including approximating a circle) to a set of given points.

    Code:
     
    ****************************
    * Plot here
    ****************************
    Attached Images Attached Images  
    Last edited by VBAhack; Jul 30th, 2007 at 03:44 PM.

  2. #2
    Junior Member Squab 14's Avatar
    Join Date
    Aug 2006
    Posts
    29

    Re: xxx

    ...o_O.....
    Take a moment to rate useful posts


  3. #3
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: xxx

    I was hoping it was XXX literally.

  4. #4
    Junior Member Squab 14's Avatar
    Join Date
    Aug 2006
    Posts
    29

    Re: xxx

    lol.
    Take a moment to rate useful posts


  5. #5
    Fanatic Member eSPiYa's Avatar
    Join Date
    Jun 2006
    Location
    in our house
    Posts
    751

    Re: xxx

    Porn?!

  6. #6
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: xxx

    All your pr0n are belong to us.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width