瀏覽代碼

add cross method to Vector2

zhaoy 7 年之前
父節點
當前提交
ceef48eedc
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/math/Vector2.js

+ 6 - 0
src/math/Vector2.js

@@ -353,6 +353,12 @@ Object.assign( Vector2.prototype, {
 
 	},
 
+	cross: function ( v ) {
+
+		return this.x * v.y - this.y * v.x;
+
+	},
+
 	lengthSq: function () {
 
 		return this.x * this.x + this.y * this.y;