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
|
| #include "math3d.hsp"
#module
#deffunc PSDivVec double inv1x, double inv1y, double inv1z, double inv2x, double inv2y, double inv2z, var outv3x, var outv3y, var outv3z, var outv4x, var outv4y, var outv4z
dot12 = DotPrd( inv1x, inv1y, inv1z, inv2x, inv2y, inv2z) / absv( inv1x, inv1y, inv1z ) / absv( inv2x, inv2y, inv2z )
lnv1 = absv( inv1x, inv1y, inv1z)
lnv2 = absv( inv2x, inv2y, inv2z)
if lnv2=0 : return 1 lv3 = lnv1 / lnv2 * dot12
outv3x = lv3 * inv2x
outv3y = lv3 * inv2y
outv3z = lv3 * inv2z
outv4x = inv1x - outv3x
outv4y = inv1y - outv3y
outv4z = inv1z - outv3z
return
#global
inv1x = 200.0
inv1y = 100.0
inv1z = 0.0
inv2x = 50.0
inv2y = 0.0
inv2z = 0.0
outv3x= 0.0
outv3y= 0.0
outv3z= 0.0
outv4x= 0.0
outv4y= 0.0
outv4z= 0.0
cx = ginfo_winx/2 cy = ginfo_winy/2
*main
redraw 1 : await 33 : redraw 0 : color 255,255,255 : boxf : color
pos 0,0 : mes "マウスのホイールを回してください。"
th += mousew/120*5
inv2x = 50.0 * cos(3.1415/180*th)
inv2y = 50.0 * sin(3.1415/180*th)
inv1x = double(mousex)-cx
inv1y = double(mousey)-cy
DrwArrow cx, cy, cx + inv1x, cy + inv1y
DrwArrow cx, cy, cx + inv2x, cy + inv2y
PSDivVec inv1x, inv1y, inv1z, inv2x, inv2y, inv2z, outv3x, outv3y, outv3z, outv4x, outv4y, outv4z
color 255,0,0
line cx, cy, cx + outv3x, cy + outv3y
line cx, cy, cx + outv4x, cy + outv4y
line mousex, mousey, cx + outv3x, cy + outv3y
line mousex, mousey, cx + outv4x, cy + outv4y
goto *main
|