|
|
And here is a shape where six bicubic patches
meet at one of the control points.
Below is some code that show how the shape was
defined and how macros was called in order to
have the shape drawn.
Tor Olav
#declare A = 0.3;
#declare I = 1.0;
#declare J = 1.0;
#declare K = 1.0;
#declare P = 2.0;
#declare Q = 2.0;
#declare R = 2.0;
#declare Points =
array[37] {
< 0, 0, 0>, // 00
< A, -J, -A>, // 01
< I, -A, A>, // 02
< A, A, K>, // 03
<-A, J, A>, // 04
<-I, A, -A>, // 05
<-A, -A, -K>, // 06
< I, -J, 0>, // 07
< I, 0, K>, // 08
< 0, J, K>, // 09
<-I, J, 0>, // 10
<-I, 0 ,-K>, // 11
< 0, -J, -K>, // 12
< A, -Q, -A>, // 13
< P, -A, A>, // 14
< A, A, R>, // 15
<-A, Q, A>, // 16
<-P, A, -A>, // 17
<-A, -A, -R>, // 18
< I, -Q, 0>, // 19
< P, -J, 0>, // 20
< P, 0, K>, // 21
< I, 0, R>, // 22
< 0, J, R>, // 23
< 0, Q, K>, // 24
<-I, Q, 0>, // 25
<-P, J, 0>, // 26
<-P, 0, -K>, // 27
<-I, 0, -R>, // 28
< 0, -J, -R>, // 29
< 0, -Q, -K>, // 30
< P, -Q, 0>, // 31
< P, 0, R>, // 32
< 0, Q, R>, // 33
<-P, Q, 0>, // 34
<-P, 0, -R>, // 35
< 0, -Q, -R> // 36
}
#declare Patches =
array[24] {
array [4] { 0, 1, 7, 2 }, // 00
array [4] { 0, 2, 8, 3 }, // 01
array [4] { 0, 3, 9, 4 }, // 02
array [4] { 0, 4, 10, 5 }, // 03
array [4] { 0, 5, 11, 6 }, // 04
array [4] { 0, 6, 12, 1 }, // 05
array [4] { 1, 13, 19, 7 }, // 06
array [4] { 2, 7, 20, 14 }, // 07
array [4] { 2, 14, 21, 8 }, // 08
array [4] { 3, 8, 22, 15 }, // 09
array [4] { 3, 15, 23, 9 }, // 10
array [4] { 4, 9, 24, 16 }, // 11
array [4] { 4, 16, 25, 10 }, // 12
array [4] { 5, 10, 26, 17 }, // 13
array [4] { 5, 17, 27, 11 }, // 14
array [4] { 6, 11, 28, 18 }, // 15
array [4] { 6, 18, 29, 12 }, // 16
array [4] { 1, 12, 30, 13 }, // 17
array [4] { 7, 19, 31, 20 }, // 18
array [4] { 8, 21, 32, 22 }, // 19
array [4] { 9, 23, 33, 24 }, // 20
array [4] { 10, 25, 34, 26 }, // 21
array [4] { 11, 27, 35, 28 }, // 22
array [4] { 12, 29, 36, 30 }, // 23
}
union {
DrawAllPatches(
Points,
Patches,
PointNormals(Points, Patches)
)
texture { ... }
}
Post a reply to this message
Attachments:
Download 'SixPatches.jpg' (31 KB)
Preview of image 'SixPatches.jpg'
|
|