描述4维空间中的一个[vector]
(矢量) 注意:构造之后只读,对于实例中的 x/y/z/w 进行修改是无意义的
local v1 = Vector4.New(100,100,100,1)
local v2 = Vector4.New(50,50,50,1)
local v3 = v1 + v2
local v4 = v1 - v2
local v5 = v1*v2
local v6 = v1/v2
local v7 = -v1
print("v1 x:"..tostring(v1.x).." y:"..tostring(v1.y).." z:"..tostring(v1.z).." w:"..tostring(v1.w))
print("v2 x:"..tostring(v2.x).." y:"..tostring(v2.y).." z:"..tostring(v2.z).." w:"..tostring(v2.w))
print("v3 x:"..tostring(v3.x).." y:"..tostring(v3.y).." z:"..tostring(v3.z).." w:"..tostring(v3.w))
print("v4 x:"..tostring(v4.x).." y:"..tostring(v4.y).." z:"..tostring(v4.z).." w:"..tostring(v4.w))
print("v5 x:"..tostring(v5.x).." y:"..tostring(v5.y).." z:"..tostring(v5.z).." w:"..tostring(v5.w))
print("v6 x:"..tostring(v6.x).." y:"..tostring(v6.y).." z:"..tostring(v6.z).." w:"..tostring(v6.w))
print("v7 x:"..tostring(v7.x).." y:"..tostring(v7.y).." z:"..tostring(v7.z).." w:"..tostring(v7.w))
Vector4.Normalize(v1)
print("v1 x:"..tostring(v1.x).." y:"..tostring(v1.y).." z:"..tostring(v1.z).." w:"..tostring(v1.w))
v2:Normalize()
print("v2 x:"..tostring(v2.x).." y:"..tostring(v2.y).." z:"..tostring(v2.z).." w:"..tostring(v2.w))