{"ScriptPreparationCode":"var mArrData = [0, 0, 0, 0, 0, 0, 0, 0, 0];\r\nvar m1ArrData = [0, 0, 0, 0, 0, 0, 0, 0, 0];\r\nvar mData = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\r\nvar m1Data = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\r\n\r\nfor(var i = 0; i \u003C 9; i\u002B\u002B) {\r\n mArrData[i] = Math.random();\r\n m1ArrData[i] = Math.random();\r\n}\r\n\r\nfor(var i = 0; i \u003C 3; i\u002B\u002B) {\r\n for(var j = 0; j \u003C 3; j\u002B\u002B) {\r\n mData[i][j] = mArrData[i \u002B j];\r\n m1Data[i][j] = m1ArrData[i \u002B j];\r\n }\r\n}","TestCases":[{"Name":"Vanilla","Code":"let v1 = [1, 2, 3];\r\nlet v2 = [4, 5, 6];\r\n\r\n// add\r\nv1[0] \u002B= v2[0];\r\nv1[1] \u002B= v2[1];\r\nv1[2] \u002B= v2[2];\r\n// normalize\r\nlet invLength = 1 / Math.sqrt(v1[0] * v1[0] \u002B v1[1] * v1[1] \u002B v1[2] * v1[2]);\r\nv1[0] *= invLength;\r\nv1[1] *= invLength;\r\nv1[2] *= invLength;\r\n// cross\r\nlet ax = v1[0], ay = v1[1], az = v1[2];\r\nlet bx = v2[0], by = v2[1], bz = v2[2];\r\nv1[0] = ay * bz - az * by;\r\nv1[1] = az * bx - ax * bz;\r\nv1[2] = ax * by - ay * bx;\r\n\r\nfloatArray[index] = floatArray[index] \u002B v1[0] - v1[0] \u002B v1[0];\r\nindex = (index \u002B 1) % defaultCount;","IsDeferred":false},{"Name":"glmatrix","Code":"var v1 = vec3.fromValues(1,2,3);\r\nvar v2 = vec3.fromValues(4,5,6);\r\n\r\nvec3.add(v1, v2, v1);\r\nvec3.normalize(v1, v1);\r\nvec3.cross(v1, v2, v1);\r\n\r\nfloatArray[index] = floatArray[index] \u002B v1[0] - v1[0] \u002B v1[0];\r\nindex = (index \u002B 1) % defaultCount;","IsDeferred":false},{"Name":"ES6 class","Code":"\r\nvar v1 = new CVec(1,2,3);\r\nvar v2 = new CVec(4,5,6);\r\n\r\nv1.add(v2);\r\nv1.normalize();\r\nv1.cross(v2);\r\n\r\n\r\nfloatArray[index] = floatArray[index] \u002B v1.x - v1.y \u002B v1.z;\r\nindex = (index \u002B 1) % defaultCount;","IsDeferred":false},{"Name":"No Array","Code":"let v1x = 1, v1y = 2, v1z = 3;\r\nlet v2x = 4, v2y = 5, v2z = 6;\r\n\r\n// add\r\nv1x \u002B= v2x;\r\nv1y \u002B= v2y;\r\nv1z \u002B= v2z;\r\n// normalize\r\nlet invLength = 1 / Math.sqrt(v1x * v1x \u002B v1y * v1y \u002B v1z * v1z);\r\nv1x *= invLength;\r\nv1y *= invLength;\r\nv1z *= invLength;\r\n// cross\r\nlet ax = v1x, ay = v1y, az = v1z;\r\nlet bx = v2x, by = v2y, bz = v2z;\r\nv1x = ay * bz - az * by;\r\nv1y = az * bx - ax * bz;\r\nv1z = ax * by - ay * bx;\r\n\r\nfloatArray[index] = floatArray[index] \u002B v1x - v1y \u002B v1z;\r\nindex = (index \u002B 1) % defaultCount;","IsDeferred":false},{"Name":"N3D","Code":"var v1 = new $V3(1,2,3);\r\nvar v2 = new $V3(4,5,6);\r\n\r\nv1.add(v2);\r\nv1.normalize();\r\nv1.cross(v2);\r\n\r\nfloatArray[index] = floatArray[index] \u002B v1.x - v1.y \u002B v1.z;\r\nindex = (index \u002B 1) % defaultCount;","IsDeferred":false},{"Name":"Closure","Code":"var v1 = new goog.math.Vec3(1,2,3);\r\nvar v2 = new goog.math.Vec3(4,5,6);\r\n\r\nv1.add(v2);\r\nv1.normalize();\r\nv1 = goog.math.Vec3.cross(v2, v1);\r\n\r\nfloatArray[index] = floatArray[index] \u002B v1.x - v1.y \u002B v1.z;\r\nindex = (index \u002B 1) % defaultCount;","IsDeferred":false}]}