Coords.php:
Coords.php:
-Added basic vector algebra (dot, cross, unit)
UniSim.php:
-Proved it.

file:a/Coords.php -> file:b/Coords.php
--- a/Coords.php
+++ b/Coords.php
@@ -1,4 +1,6 @@
 <?php 
+// TODO: Fix converts to be less duplicate-y.
+// TODO: More vector algebra.
 abstract class Coords {	
 	// Vector math only actually makes sense in Cartesian, so we have to 
 	// convert there, and convert back.
@@ -22,6 +24,32 @@
 		return $vector3->convert($class);
 	}
 	
+	public function dot_product($vector2) {
+		$vector1 = $this->convert("CartesianCoords");
+		$vector2 = $vector2->convert("CartesianCoords");
+		list($x1, $y1, $z1) = $vector1->triplet();
+		list($x2, $y2, $z2) = $vector2->triplet();
+		$dot = $x1 * $x2 + $y1 * $y2 + $z1 * $z2;
+		return $dot;
+	}
+	
+	public function cross_product($vector2) {
+		$class = get_class($vector2);
+		$vector1 = $this->convert("CartesianCoords");
+		$vector2 = $vector2->convert("CartesianCoords");
+		list($x1, $y1, $z1) = $vector1->triplet();
+		list($x2, $y2, $z2) = $vector2->triplet();
+		$vector3 = new CartesianCoords($y1*$z2 - $z1*$y2, $x1*$z2 - $z1*$x2, $x1*$y2 - $y1*$x2);
+		return $vector3->convert($class);
+	}
+	
+	public function unit_vector() {
+		$class = get_class($this);
+		$vector1 = $this->convert("SphericalCoords");
+		list($r, $t, $p) = $vector1->triplet();
+		$unit = new SphericalCoords(1, $t, $p);
+		return $unit->convert($class);
+	}
 }
 
 class SphericalCoords extends Coords {
@@ -144,3 +172,4 @@
 	}
 }
 ?>
+

file:a/UniSim.php -> file:b/UniSim.php
--- a/UniSim.php
+++ b/UniSim.php
@@ -28,5 +28,16 @@
 printf("Vector5 = Vector1 - Vector2: %s\n", $vector5->string());
 $vector6 = $vector2->vector_subtract($vector1);
 printf("Vector6 = Vector2 - Vector1: %s\n", $vector6->string());
+$dot_1_2 = $vector1->dot_product($vector2);
+printf("Vector1 · Vector2: %.2f\n", $dot_1_2);
+$vector7 = $vector1->cross_product($vector2);
+printf("Vector7 = Vector1 × Vector2: %s\n", $vector7->string());
+$vector8 = $vector2->cross_product($vector1);
+printf("Vector8 = Vector2 × Vector1: %s\n", $vector8->string());
+$vector9 = $vector1->unit_vector();
+printf("Vector9 = (unit)Vector1: %s\n", $vector9->string());
+$vector10 = $vector2->unit_vector();
+printf("Vector10 = (unit)Vector2: %s\n", $vector10->string());
 
 ?>
+