Exemplo n.º 1
0
 /**
  * Computes the vector triple product of three vectors.
  *
  * @api
  * @param self $b The second vector of the triple product.
  * @param self $c The third vector of the triple product.
  * @return self The vector triple product of the three vectors.
  * @throws Exception if the vectors are not 3-dimensional.
  * @throws Exception if the vectors are not in the same vector space.
  * @see self::_checkVectorSpace() For exception information.
  */
 public function vectorTripleProduct(self $b, self $c)
 {
     return $this->crossProduct($b->crossProduct($c));
 }
Exemplo n.º 2
0
 /**
  * Verify that cross product fails with two-dimensional vectors.
  *
  * @test
  * @uses \Nubs\Vectorix\Vector::__construct
  * @uses \Nubs\Vectorix\Vector::components
  * @uses \Nubs\Vectorix\Vector::dimension
  * @uses \Nubs\Vectorix\Vector::isSameDimension
  * @uses \Nubs\Vectorix\Vector::isSameVectorSpace
  * @uses \Nubs\Vectorix\Vector::_checkVectorSpace
  * @covers ::crossProduct
  * @expectedException Exception
  * @expectedExceptionMessage Both vectors must be 3-dimensional
  */
 public function crossProductOfTwoDimensionalVectors()
 {
     $a = new Vector([7, 2]);
     $b = new Vector([1, 9]);
     $a->crossProduct($b);
 }