Skip to content

Instantly share code, notes, and snippets.

@zakki
Created February 15, 2011 14:43
Show Gist options
  • Save zakki/827602 to your computer and use it in GitHub Desktop.
Save zakki/827602 to your computer and use it in GitHub Desktop.
HSP3CNVのテスト
goto *L0000
#module m0
#defcfunc vdot array v0, array v1
return v0.0 * v1.0 + v0.1 * v1.1 + v0.2 * v1.2
#defcfunc vdot1 array v0
return v0.0 * v0.0 + v0.1 * v0.1 + v0.2 * v0.2
#deffunc vnormalize array c, local len
len = sqrt(vdot(c, c))
mes len
c(0) /= len
c(1) /= len
c(2) /= len
return
#defcfunc drand
r = double(rnd(32768)) / 32768.0
return r
#global
*L0000
ddim vec, 3
vec.0 = 1.0
vec.1 = 2.0
vec.2 = 0.0
a = vdot(vec, vec)
mes vdot(vec, vec)
mes vdot1(vec)
vnormalize vec
mes "x="+vec.0
mes "y="+vec.1
mes "z="+vec.2
mes drand()
mes drand()
stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment