/
modeling-tests.factor
46 lines (40 loc) · 1.77 KB
/
modeling-tests.factor
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
USING: accessors kernel tools.test euler.b-rep euler.operators
euler.modeling game.models.half-edge ;
IN: euler.modeling.tests
! polygon>double-face
{ } [
[
{ { -1 -1 0 } { 1 -1 0 } { 1 1 0 } { -1 1 0 } }
smooth-smooth polygon>double-face
[ face-sides 4 assert= ]
[ opposite-edge>> face-sides 4 assert= ]
[ face-normal { 0.0 0.0 1.0 } assert= ]
tri
] make-b-rep check-b-rep
] unit-test
! extrude-simple
{ } [
[
{ { -1 -1 0 } { 1 -1 0 } { 1 1 0 } }
smooth-smooth polygon>double-face
1 f extrude-simple
[ face-sides 3 assert= ]
[ opposite-edge>> face-sides 4 assert= ]
bi
] make-b-rep check-b-rep
] unit-test
! project-pt-line
{ { 0 1 0 } } [ { 0 0 0 } { 0 1 0 } { 1 1 0 } project-pt-line ] unit-test
{ { 0 1 0 } } [ { 0 0 0 } { 1 1 0 } { 0 1 0 } project-pt-line ] unit-test
{ { 0 1 0 } } [ { 0 0 0 } { 2 1 0 } { 1 1 0 } project-pt-line ] unit-test
{ { -1 1 0 } } [ { -1 0 0 } { 2 1 0 } { 1 1 0 } project-pt-line ] unit-test
{ { 1/2 1/2 0 } } [ { 0 0 0 } { 0 1 0 } { 1 0 0 } project-pt-line ] unit-test
! project-pt-plane
{ { 0 0 1 } } [ { 0 0 0 } { 0 0 1 } { 0 0 1 } -1 project-pt-plane ] unit-test
{ { 0 0 -1 } } [ { 0 0 0 } { 0 0 1 } { 0 0 1 } 1 project-pt-plane ] unit-test
{ { 0 0 3 } } [ { 0 0 0 } { 0 0 1 } { 0 0 1 } -3 project-pt-plane ] unit-test
{ { 0 0 3 } } [ { 0 0 0 } { 0 0 1 } { 0 0 -1 } 3 project-pt-plane ] unit-test
{ { 0 0 1 } } [ { 0 0 0 } { 0 0 1 } { 0 1 1 } -1 project-pt-plane ] unit-test
{ { 0 2/3 1/3 } } [ { 0 0 0 } { 0 2 1 } { 0 1 1 } -1 project-pt-plane ] unit-test
{ { 0 0 1 } } [ { 0 0 0 } { 0 0 1/2 } { 0 0 1 } -1 project-pt-plane ] unit-test
{ { 0 1 1 } } [ { 0 0 0 } { 0 1/2 1/2 } { 0 0 1 } -1 project-pt-plane ] unit-test