src/Alg/Math/Algebra/Vector/CrossProduct.php
public function produce( $vector1, $vector2 )
	{
		if( $vector1->getDimension() != $vector2->getDimension() )
			throw new Exception( 'Dimensions of Vectors are not compatible.' );
		if( $vector1->getDimension() == 3 )
		{
			$x = $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 2 ) - $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 1 );
			$y = $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 0 ) - $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 2 );
			$z = $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 1 ) - $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 0 );
			$c = new Alg_Math_Algebra_Vector( $x, $y, $z );
		}
		return $c;
	}
public function produce( $vector1, $vector2 )
	{
		if( $vector1->getDimension() != $vector2->getDimension() )
			throw new Exception( 'Dimensions of Vectors are not compatible.' );
		if( $vector1->getDimension() == 3 )
		{
			$x = $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 2 ) - $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 1 );
			$y = $vector1->getValueFromIndex( 2 ) * $vector2->getValueFromIndex( 0 ) - $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 2 );
			$z = $vector1->getValueFromIndex( 0 ) * $vector2->getValueFromIndex( 1 ) - $vector1->getValueFromIndex( 1 ) * $vector2->getValueFromIndex( 0 );
			$c = new Alg_Math_Algebra_Vector( $x, $y, $z );
		}
		return $c;
	}
public function produce ( $ vector1 , $ vector2 ) { if ( $ vector1 -> getDimension ( ) != $ vector2 -> getDimension ( ) ) throw new Exception ( 'Dimensions of Vectors are not compatible.' ) ; if ( $ vector1 -> getDimension ( ) == 3 ) { $ x = $ vector1 -> getValueFromIndex ( 1 ) * $ vector2 -> getValueFromIndex ( 2 ) - $ vector1 -> getValueFromIndex ( 2 ) * $ vector2 -> getValueFromIndex ( 1 ) ; $ y = $ vector1 -> getValueFromIndex ( 2 ) * $ vector2 -> getValueFromIndex ( 0 ) - $ vector1 -> getValueFromIndex ( 0 ) * $ vector2 -> getValueFromIndex ( 2 ) ; $ z = $ vector1 -> getValueFromIndex ( 0 ) * $ vector2 -> getValueFromIndex ( 1 ) - $ vector1 -> getValueFromIndex ( 1 ) * $ vector2 -> getValueFromIndex ( 0 ) ; $ c = new Alg_Math_Algebra_Vector ( $ x , $ y , $ z ) ; } return $ c ; }
Returns Cross Product of two Vectors
@access		public
@param		Alg_Math_Algebra_Vector		$vector1		Vector 1
@param		Alg_Math_Algebra_Vector		$vector2		Vector 2
@return		Alg_Math_Algebra_Vector
Returns Cross Product of two Vectors