forked from tienpt/OpenGL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbezBoatData.txt
95 lines (92 loc) · 2.29 KB
/
bezBoatData.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Step 1
// Just a rectangle lying on the xz (i.e., y=0) plane.
GLfloat ctrlpoints[4][4][3] = {
{{-2.0, 0.0, 3.0},
{-1.0, 0.0, 3.0},
{0.0, 0.0, 3.0},
{1.0, 0.0, 3.0}},
{{-2.0, 0.0, 1.0},
{-1.0, 0.0, 1.0},
{0.0, 0.0, 1.0},
{1.0, 0.0, 1.0}},
{{-2.0, 0.0, -1.0},
{-1.0, 0.0, -1.0},
{0.0, 0.0, -1.0},
{1.0, 0.0, -1.0}},
{{-2.0, 0.0, -3.0},
{-1.0, 0.0, -3.0},
{0.0, 0.0, -3.0},
{1.0, 0.0, -3.0}},
};
// Step 2
// Only change is the x-coordinates of the *first* 4 vertices -
// we "stitch" the two halves of one side together. In other
// words, we fold one side in half.
GLfloat ctrlpoints[4][4][3] = {
{{1.0, 0.0, 3.0},
{0.0, 0.0, 3.0},
{0.0, 0.0, 3.0},
{1.0, 0.0, 3.0}},
{{-2.0, 0.0, 1.0},
{-1.0, 0.0, 1.0},
{0.0, 0.0, 1.0},
{1.0, 0.0, 1.0}},
{{-2.0, 0.0, -1.0},
{-1.0, 0.0, -1.0},
{0.0, 0.0, -1.0},
{1.0, 0.0, -1.0}},
{{-2.0, 0.0, -3.0},
{-1.0, 0.0, -3.0},
{0.0, 0.0, -3.0},
{1.0, 0.0, -3.0}},
};
// Step 3
// Do the same for the opposite side: only change is the
// x-coordinates of the *last* 4 vertices.
//
// It looks a little like a boat already but this one will never float -
// because it is totally flat!! All the vertices are on the xz-plane
// (all the y-coordinates are 0), so the object lies entirely on
// the xz-plane. The thickness is an illusion of the curved lines.
GLfloat ctrlpoints[4][4][3] = {
{{1.0, 0.0, 3.0},
{0.0, 0.0, 3.0},
{0.0, 0.0, 3.0},
{1.0, 0.0, 3.0}},
{{-2.0, 0.0, 1.0},
{-1.0, 0.0, 1.0},
{0.0, 0.0, 1.0},
{1.0, 0.0, 1.0}},
{{-2.0, 0.0, -1.0},
{-1.0, 0.0, -1.0},
{0.0, 0.0, -1.0},
{1.0, 0.0, -1.0}},
{{1.0, 0.0, -3.0},
{0.0, 0.0, -3.0},
{0.0, 0.0, -3.0},
{1.0, 0.0, -3.0}},
};
// Step 4
// Now we "plump" it up in the middle by varying the
// y-coordinates - the changes are the y-coordinates of
// the *middle* two vertices.
//
// Now it is indeed a 3-dimensional object!
GLfloat ctrlpoints[4][4][3] = {
{{1.0, 0.0, 3.0},
{0.0, 0.0, 3.0},
{0.0, 0.0, 3.0},
{1.0, 0.0, 3.0}},
{{1.0, -2.0, 1.0},
{0.0, -1.0, 1.0},
{0.0, 1.0, 1.0},
{1.0, 2.0, 1.0}},
{{1.0, -2.0, -1.0},
{0.0, -1.0, -1.0},
{0.0, 1.0, -1.0},
{1.0, 2.0, -1.0}},
{{1.0, 0.0, -3.0},
{0.0, 0.0, -3.0},
{0.0, 0.0, -3.0},
{1.0, 0.0, -3.0}},
};