Exemplo n.º 1
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testSetInvalidElement()
 {
     // Arrange
     $vector = new Vector3(0, 0, 0);
     // Act
     $vector->setElement(123, 0);
     // Assert
     // ...
 }
Exemplo n.º 2
0
 /**
  * Calculates the cross product between this vector and the given vector.
  *
  * @param Vector3 $vector The vector to calculate with.
  * @return Vector3
  */
 public function crossProduct(Vector3 $vector)
 {
     $x = BigNumberUtils::multiply($this->getY(), $vector->getZ());
     $x->subtract(BigNumberUtils::multiply($this->getZ(), $vector->getY()));
     $y = BigNumberUtils::multiply($this->getZ(), $vector->getX());
     $y->subtract(BigNumberUtils::multiply($this->getX(), $vector->getZ()));
     $z = BigNumberUtils::multiply($this->getX(), $vector->getY());
     $z->subtract(BigNumberUtils::multiply($this->getY(), $vector->getX()));
     return new Vector3($x, $y, $z);
 }