-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex1.jl
38 lines (29 loc) · 846 Bytes
/
ex1.jl
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
include("cg.jl")
using CG;
include("render.jl");
v1 = Vec4f(1, 0, 0, 0);
v2 = Vec4f(0.0, 42.0, 0.0, 0.0);
println(v1 - v2);
m1 = Mat4f(Vec4f(1.0, 0.0, 0.0, 0.0),
Vec4f(0.0, 1.0, 0.0, 0.0),
Vec4f(0.0, 0.0, 1.0, 0.0),
Vec4f(0.0, 0.0, 0.0, 1.0));
println(2 * (m1 * v1));
println(m1 * v2);
v1 = Vec4f(1, 0, 0, 1);
v2 = Vec4f(0, 0, 0, 1);
v3 = Vec4f(0, 0, 1, 1);
triangle = Object(v1, v2, v3);
house = Object(Vec4f(-1, -1, 0, 1),
Vec4f(1, -1, 0, 1),
Vec4f(-1, 1, 0, 1),
Vec4f(0, 2, 0, 1),
Vec4f(1, 1, 0, 1),
Vec4f(1, 1, 0, 1),
Vec4f(-1, -1, 0, 1),
Vec4f(-1, 1, 0, 1),
Vec4f(1, 1, 0, 1),
Vec4f(1, -1, 0, 1))
#render(translation(Vec4f(1.5, 0, 0, 1)) * house, figAxis=[-2, 2, -2, 2]);
#render(scaling(Vec4f(0.5, 0.5, 0.5, 1)) * house, figAxis=[-2, 2, -2, 2]);
render(roty(pi/4) * house, figAxis=[-2, 2, -2, 2]);