POV-Ray : Newsgroups : povray.advanced-users : bicubic bezier and hermite patches : Re: bicubic bezier and hermite patches Server Time
29 Jul 2024 02:28:12 EDT (-0400)
  Re: bicubic bezier and hermite patches  
From: andrel
Date: 18 Mar 2004 11:56:01
Message: <4059D478.4020307@hotmail.com>
As promised here are some 16 by 16 matrices.

For the bezier control points (Bxy) I assume that they are numbered
from left to right and from top to bottom (just as POV does)
For the actual points (Axy) I take the values at a grid with 1/3
separation and counting from left to right and from top to bottom
i.e. A11=(0,0),A12=(1/3,0),A13=(2/3,0),A14=(1,0), A21=(0,1/3),
A22=(1/3,1/3),...A44=(1,1)
For the Hermite representation I use H11=u(0,0),H12=du(0,0)/dx,
H13=du(0,0)/dy,H14=d^2u(0,0)/dxdy,H21=u(1,0),...H44=d^2u(1,1)/dxdy

I have scaled all matrices by a factor such that all values
are integers in order not to loose accuracy.

This one is to convert from Bezier control points to grid points
(divide by 729)
So A11=B11, A12=8/27*B11+4/9*B12+2/9*B13+1/27*B14

  729,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
  216, 324, 162,  27,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
   27, 162, 324, 216,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
    0,   0,   0, 729,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
  216,   0,   0,   0, 324,   0,   0,   0, 162,   0,   0,   0,  27,   0, 
   0,   0,
   64,  96,  48,   8,  96, 144,  72,  12,  48,  72,  36,   6,   8,  12, 
   6,   1,
    8,  48,  96,  64,  12,  72, 144,  96,   6,  36,  72,  48,   1,   6, 
  12,   8,
    0,   0,   0, 216,   0,   0,   0, 324,   0,   0,   0, 162,   0,   0, 
   0,  27,
   27,   0,   0,   0, 162,   0,   0,   0, 324,   0,   0,   0, 216,   0, 
   0,   0,
    8,  12,   6,   1,  48,  72,  36,   6,  96, 144,  72,  12,  64,  96, 
  48,   8,
    1,   6,  12,   8,   6,  36,  72,  48,  12,  72, 144,  96,   8,  48, 
  96,  64,
    0,   0,   0,  27,   0,   0,   0, 162,   0,   0,   0, 324,   0,   0, 
   0, 216,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 729,   0, 
   0,   0,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 216, 324, 
162,  27,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  27, 162, 
324, 216,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0, 729,

This one is to convert from grid points to Bezier control points
(divide by 36)
So B11=A11, B12=-5/6*A11+3*A12-1.5*A13+1/3*A14
   36,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
  -30, 108, -54,  12,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
   12, -54, 108, -30,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
    0,   0,   0,  36,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
  -30,   0,   0,   0, 108,   0,   0,   0, -54,   0,   0,   0,  12,   0, 
   0,   0,
   25, -90,  45, -10, -90, 324,-162,  36,  45,-162,  81, -18, -10,  36, 
-18,   4,
  -10,  45, -90,  25,  36,-162, 324, -90, -18,  81,-162,  45,   4, -18, 
  36, -10,
    0,   0,   0, -30,   0,   0,   0, 108,   0,   0,   0, -54,   0,   0, 
   0,  12,
   12,   0,   0,   0, -54,   0,   0,   0, 108,   0,   0,   0, -30,   0, 
   0,   0,
  -10,  36, -18,   4,  45,-162,  81, -18, -90, 324,-162,  36,  25, -90, 
  45, -10,
    4, -18,  36, -10, -18,  81,-162,  45,  36,-162, 324, -90, -10,  45, 
-90,  25,
    0,   0,   0,  12,   0,   0,   0, -54,   0,   0,   0, 108,   0,   0, 
   0, -30,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  36,   0, 
   0,   0,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, -30, 108, 
-54,  12,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  12, -54, 
108, -30,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,  36,

This one is to convert from Hermite representation to grid points
(divide by 729)
So A11=H11, A12=20/27*H11+4/27*H12+7/27*H21-2/27*H22
NB A14=H21

  729,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
  540, 108,   0,   0, 189, -54,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
  189,  54,   0,   0, 540,-108,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
    0,   0,   0,   0, 729,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
  540,   0, 108,   0,   0,   0,   0,   0, 189,   0, -54,   0,   0,   0, 
   0,   0,
  400,  80,  80,  16, 140, -40,  28,  -8, 140,  28, -40,  -8,  49, -14, 
-14,   4,
  140,  40,  28,   8, 400, -80,  80, -16,  49,  14, -14,  -4, 140, -28, 
-40,   8,
    0,   0,   0,   0, 540,   0, 108,   0,   0,   0,   0,   0, 189,   0, 
-54,   0,
  189,   0,  54,   0,   0,   0,   0,   0, 540,   0,-108,   0,   0,   0, 
   0,   0,
  140,  28,  40,   8,  49, -14,  14,  -4, 400,  80, -80, -16, 140, -40, 
-28,   8,
   49,  14,  14,   4, 140, -28,  40,  -8, 140,  40, -28,  -8, 400, -80, 
-80,  16,
    0,   0,   0,   0, 189,   0,  54,   0,   0,   0,   0,   0, 540, 
0,-108,   0,
    0,   0,   0,   0,   0,   0,   0,   0, 729,   0,   0,   0,   0,   0, 
   0,   0,
    0,   0,   0,   0,   0,   0,   0,   0, 540, 108,   0,   0, 189, -54, 
   0,   0,
    0,   0,   0,   0,   0,   0,   0,   0, 189,  54,   0,   0, 540,-108, 
   0,   0,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 729,   0, 
   0,   0,

Finally, this one is to convert from grid points to Hermite
representation (divide by 4)
So H11=A11, H12=-11/2*A11+9*A12-9/2*A13+H14
    4,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
  -22,  36, -18,   4,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
  -22,   0,   0,   0,  36,   0,   0,   0, -18,   0,   0,   0,   4,   0, 
   0,   0,
  121,-198,  99, -22,-198, 324,-162,  36,  99,-162,  81, -18, -22,  36, 
-18,   4,
    0,   0,   0,   4,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
   -4,  18, -36,  22,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   0,
    0,   0,   0, -22,   0,   0,   0,  36,   0,   0,   0, -18,   0,   0, 
   0,   4,
   22, -99, 198,-121, -36, 162,-324, 198,  18, -81, 162, -99,  -4,  18, 
-36,  22,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   4,   0, 
   0,   0,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, -22,  36, 
-18,   4,
   -4,   0,   0,   0,  18,   0,   0,   0, -36,   0,   0,   0,  22,   0, 
   0,   0,
   22, -36,  18,  -4, -99, 162, -81,  18, 198,-324, 162, -36,-121, 198, 
-99,  22,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 
   0,   4,
    0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  -4,  18, 
-36,  22,
    0,   0,   0,  -4,   0,   0,   0,  18,   0,   0,   0, -36,   0,   0, 
   0,  22,
    4, -18,  36, -22, -18,  81,-162,  99,  36,-162, 324,-198, -22, 
99,-198, 121,

I hope the meaning of these grids is clear (and I did not make any
stupid mistakes). I think it is obvious why I should have made some
macro's ;)

	Andrel


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.