Example #1
0
 /**
  * Calculates the angle between the two given vectors.
  *
  * @param Vector $lft The left vector.
  * @param Vector $rgt The right vector.
  * @return float Returns the angle in radians.
  */
 public static function angleBetween(Vector $lft, Vector $rgt)
 {
     return acos($lft->dotProduct($rgt)->getValue());
 }
Example #2
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testDotProductWithInvalidSizeVector()
 {
     // Arrange
     $vector1 = new Vector(array(4, 5, 6));
     $vector2 = new Vector(array(4, 5, 6, 7));
     // Act
     $vector1->dotProduct($vector2);
 }