mirror of
				https://codeberg.org/1414codeforge/gear.git
				synced 2025-06-05 22:09:24 +02:00 
			
		
		
		
	[vec] Add cross product between vectors.
This commit is contained in:
		
							
								
								
									
										7
									
								
								vec.lua
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								vec.lua
									
									
									
									
									
								
							| @@ -25,6 +25,13 @@ function vec.dot3(x1,y1,z1, x2,y2,z2) | |||||||
|     return x1*x2 + y1*y2 + z1*z2 |     return x1*x2 + y1*y2 + z1*z2 | ||||||
| end | end | ||||||
|  |  | ||||||
|  | --- Vector cross product. | ||||||
|  | function vec.cross(x1,y1,z1, x2,y2,z2) | ||||||
|  |     return y1*z2 - z1*y2, | ||||||
|  |            z1*x2 - x1*z2, | ||||||
|  |            x1*y2 - y1*x2 | ||||||
|  | end | ||||||
|  |  | ||||||
| --- Vector squared length. | --- Vector squared length. | ||||||
| function vec.sqrlen(x,y) | function vec.sqrlen(x,y) | ||||||
|     return x*x + y*y  -- vec.dot(x,y, x,y) |     return x*x + y*y  -- vec.dot(x,y, x,y) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user