-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbezier_surface_3d.mac
64 lines (47 loc) · 1.19 KB
/
bezier_surface_3d.mac
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
/*
https://github.com/t-o-k/Maxima-bezier/bezier_surface_3d.mac
Copyright (c) 2020 Tor Olav Kristensen, http://subcube.com
Use of this source code is governed by the GNU Lesser General Public License version 3, which can be found in the LICENSE file.
*/
kill(all);
load("draw");
load("bezier");
points_x:
matrix(
[ 0.0, 1.0, 2.0, 3.0 ],
[ 0.0, 1.0, 2.0, 4.0 ],
[ 0.0, 1.0, 2.0, 2.5 ],
[ 0.0, 1.0, 2.0, 3.0 ]
)
;
points_y:
matrix(
[ 0.0, 0.0, 1.0, 0.0 ],
[ 1.0, 1.0, 2.0, 1.0 ],
[ 2.0, 2.0, 3.0, 2.0 ],
[ 3.0, 3.0, 5.0, 3.0 ]
)
;
points_z:
matrix(
[ 2.0, 0.0, 0.0, -3.0 ],
[ -2.0, -3.0, -2.0, 3.0 ],
[ 0.0, -4.0, 0.0, 2.0 ],
[ 2.0, 0.0, 0.0, -3.0 ]
)
;
define(surface_x(u, v), bezier_function_2a(points_x, u, v));
define(surface_y(u, v), bezier_function_2a(points_y, u, v));
define(surface_z(u, v), bezier_function_2a(points_z, u, v));
expand(surface_x(u, v));
expand(surface_y(u, v));
expand(surface_z(u, v));
plot3d(
[
surface_x(u, v),
surface_y(u, v),
surface_z(u, v)
],
[ u, 0, 1 ],
[ v, 0, 1 ]
);