-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest_ray_tri.html
53 lines (45 loc) · 1.53 KB
/
test_ray_tri.html
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
<html>
<head></head>
<body>
testing ray_tri.js<br>
<script type="text/javascript" src="externals/sylvester.src.js"></script>
<script type="text/javascript" src="externals/GLGE/glge_math.js"></script>
<script type="text/javascript" src="externals/GLGE/glge.js"></script>
<script type="text/javascript" src="ray_tri.js"></script>
<script type="text/javascript">
function print(s) {document.write(s+"<br>")}
A=[0,0,0]
B=[1,0,0]
C=[0,1,.3]
T=[A,B,C]
P0=[0,0,-1]
P1=[.5,.5,2]
R=[P0,P1]
r = ray_tri_intersect(R, T)
if(r) print("answer: " + r.data); else print("answer: null")
P1=[1.5,.5,1]
R=[P0,P1]
r = ray_tri_intersect(R, T)
if(r) print("answer: " + r.data); else print("answer: null")
P0=[0,0,0]
P1=[1,0,0]
R=[P0,P1]
r = ray_tri_intersect(R, T)
if(r) print("answer: " + r.data); else print("answer: null")
P0=[0,0,0]
P1=[1,0,0.0001]
R=[P0,P1]
r = ray_tri_intersect(R, T)
if(r) print("answer: " + r.data); else print("answer: null")
/*
T = [[17.55338987388009,3.999996,10.082506916856738],[ 0.7239701777221593,4,-0.7235392005060577],[-0.3566344340141202,4,0.9594027691097353]]
R = [[1,20,8],[0.9984073471672726,19.017846976192338,7.811923150594179]]
intersect: 1-0.02594549499620237,20-16.000000653669744,4.936088735167823
*/
T = [[17.55338987388009,3.999996,10.082506916856738],[ 0.7239701777221593,4,-0.7235392005060577],[-0.3566344340141202,4,0.9594027691097353]]
R = [[1,20,8],[0.9984073471672726,19.017846976192338,7.811923150594179]]
r = ray_tri_intersect(R, T)
if(r) print("answer: " + r.data); else print("answer: null")
</script>
</body>
</html>