
-----------------------
'OPERATORS USING MACROS
=======================

'PARTIAL DEMO

  type vector3f
    float x,y,z
  end type
  '
  macro vector3f_"move"(a,b)
    a.x = b.x
    a.y = b.y
    a.z = b.z
  end macro
  macro vector3f_"neg"(acc,a)
    acc.x = -a.x
    acc.y = -a.y
    acc.z = -a.z
  end macro
  macro vector3f_"+"(acc,a,b)
    acc.x = a.x + b.x
    acc.y = a.y + b.y
    acc.z = a.z + b.z
  end macro
  macro vector3f_"-"(acc,a,b)
    acc.x = a.x - b.x
    acc.y = a.y - b.y
    acc.z = a.z - b.z
  end macro
  macro vector3f_"*"(acc,a,b)
    acc.x = a.x * b.x
    acc.y = a.y * b.y
    acc.z = a.z * b.z
  end macro
  macro vector3f_"/"(acc,a,b)
    acc.x = a.x / b.x
    acc.y = a.y / b.y
    acc.z = a.z / b.z
  end macro

'STR polymorph for vector3f
'
function str(vector3f *a) as string
  string cm=", "
  return str(a.x) cm str(a.y) cm str(a.z)
end function


'TESTS
'
dim vector3f A = {1,2,3}
dim vector3f B = {10,20,30}
dim vector3f C = {10,100,1000}
dim vector3f D

'#show D=C*(A+B)
'print str(D)
'print str(A)
'print str(A+B)
'print str(A*B)

print str(C*(A+B)) '110, 2200, 33000
