changeset 14:2da86c23f4f3

Cross product
author Josef "Jeff" Sipek <jeffpc@optonline.net>
date Fri, 02 Dec 2005 23:47:14 -0500
parents 51e9b6b85edd
children 20615d891b8c
files cross.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cross.c	Fri Dec 02 23:47:14 2005 -0500
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+void cross(float u[3], float v[3])
+{
+	printf("%f %f %f\n",
+				u[1]*v[2]-u[2]*v[1],
+				u[2]*v[0]-u[0]*v[2],
+				u[0]*v[1]-u[1]*v[0]);
+}
+
+int main(int argc, char **argv) 
+{
+	float u[3];
+	float v[3];
+	
+	while(scanf("%*f %*f %*f %f %f %f %*f %*f %*f %f %f %f", &u[0], &u[1], &u[2], &v[0], &v[1], &v[2])==6)
+		cross(u, v);
+	
+	return 0;
+}
+