i'm pretty sure the functions that use Memory pointer, probably won't work - cause i doubt i coded it right...
but i had 5mins just now
type fVec3_t
x as float
y as float
z as float
endtype
global dim VectorOut(3)
#constant rPI 3.14159265358979323846
#constant EQUAL_EPSILON 0.001
#constant true (1=1)
#constant false (1=0)
function VectorLength( VecX as float, VecY as float, VecZ as float )
local length as double float
local dim Vec(3) as float
Vec(0) = VecX
Vec(1) = VecY
Vec(2) = VecZ
length = 0
for i=0 to 3
length = length + Vec(i)*Vec(i)
length = sqrt(length)
next i
endfunction length
function VectorCompare( Vec1X as float, Vec1Y as float, Vec1Z as float,
Vec2X as float, Vec2Y as float, Vec2Z as float )
local result as boolean
local dim Vec1(3) as float
local dim Vec2(3) as float
Vec1(0) = Vec1X : Vec2(0) = Vec2X
Vec1(1) = Vec1Y : Vec2(1) = Vec2Y
Vec1(2) = Vec1Z : Vec2(2) = Vec2Z
for i=0 to 3
if abs(Vec1(i)-Vec2(i)) > EQUAL_EPSILON
result = false
endif
next i
endfunction result
function VectorMA( VaX as float, VaY as float, VaZ as float, scale as double float,
VbX as float, VbY as float, VbZ as float,
VcX as float, VcY as float, VcZ as float )
*Result = make memory(12)
fill memory *Result,(VecAX + scale*VecBX),8
fill memory *Result+8,(VecAY + scale*VecBY),8
fill memory *Result+16,(VecAZ + scale*VecBZ),8
endfunction *Result
function CrossProduct( Vec1X as float, Vec1Y as float, Vec1Z as float,
Vec2X as float, Vec2Y as float, Vec2Z as float )
*Result = make memory(12)
fill memory *Result,((Vec1Y*Vec2Z)-(Vec1Z*Vec2Y)),4
fill memory *Result+4,((Vec1Z*Vec2X)-(Vec1X*Vec2Z)),4
fill memory *Result+8,((Vec1X*Vec2Y)-(Vec1Y*Vec2X)),4
endfunction *Result
function DotProduct( Vec1X as float, Vec1Y as float, Vec1Z as float,
Vec2X as float, Vec2Y as float, Vec2Z as float )
*Result = make memory(12)
fill memory *Result,((Vec1X*Vec2X)+(Vec1Y*Vec2Y)+(Vec1Z*Vec2Z)),12
endfunction *Result
function VectorSubtract( Vec1X as float, Vec1Y as float, Vec1Z as float,
Vec2X as float, Vec2Y as float, Vec2Z as float )
*Result = make memory(12)
fill memory *Result,(Vec1X-Vec2X),4
fill memory *Result+4,(Vec1Y-Vec2Y),4
fill memory *Result+8,(Vec1Z-Vec2Z),4
endfunction *Result
function VectorAdd( Vec1X as float, Vec1Y as float, Vec1Z as float,
Vec2X as float, Vec2Y as float, Vec2Z as float )
*Result = make memory(12)
fill memory *Result,(Vec1X+Vec2X),4
fill memory *Result+4,(Vec1Y+Vec2Y),4
fill memory *Result+8,(Vec1Z+Vec2Z),4
endfunction *Result
function VectorNormalize( VecX as float, VecY as float, VecZ as float )
local length as double float
local dim Vec(3) as float
*Result = make memory(12)
Vec(0) = VecX
Vec(1) = VecY
Vec(2) = VecZ
length = 0
for i=0 to 3
length = length + Vec(i)*Vec(i)
length = sqrt(length)
if length=0 then result=0
next i
for i=0 to 3
Vector1(i),(Vec(i) / length),4
next i
endfunction *Result
function VectorInverse( Vec1X as float, Vec1Y as float, Vec1Z as float )
VectorOut(0)=(Vec1X-(Vec1X*2))
VectorOut(1)=(Vec1Y-(Vec1Y*2))
VectorOut(3)=(Vec1Z-(Vec1Z*2))
endfunction
function VectorInverse( Vec1X as float, Vec1Y as float, Vec1Z as float, scale as double float )
VectorOut(0)=(Vec1X*scale)
VectorOut(1)=(Vec1Y*scale)
VectorOut(3)=(Vec1Z*scale)
endfunction
this should explain vectors ALOT easier than the help - cause this shows you exactly what is going on

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?