📅  最后修改于: 2022-03-11 14:45:12.528000             🧑  作者: Mango
function dotProduct(v1:Vector., v2:Vector.):Number{ if(v1.length != v2.length) return NaN; var sum:Number = 0; for(var i:uint = 0; i < v1.length; i++) sum += v1[i]*v2[i]; return sum;}trace(dotProduct(Vector.([1,3,-5]),Vector.([4,-2,-1])));