Esempio n. 1
0
 /**
  * Axiom: |projᵇA⊥ ⋅ perpᵇA| = |projᵇA| |perpᵇA|
  * Absolute value of proj and perp dot product equals product of their lengths.
  * @dataProvider dataProviderForProjPerp
  */
 public function testProjPerpPerpDotProductEqualsProductOfLengths(array $A, array $B)
 {
     $A = new Vector($A);
     $B = new Vector($B);
     $projᵇA = $A->projection($B);
     $projᵇA⊥ = $A->projection($B)->perpendicular();
     $perpᵇA = $A->perp($B);
     $projᵇA⊥⋅perpᵇA = abs($projᵇA⊥->dotProduct($perpᵇA));
     $│projᵇA│ = $projᵇA->length();
     $│perpᵇA│ = $perpᵇA->length();
     $this->assertEquals($projᵇA⊥⋅perpᵇA, $│projᵇA│ * $│perpᵇA│);
 }
 /**
  * @dataProvider dataProviderForPerp
  */
 public function testPerp(array $A, array $B, array $expected)
 {
     $A = new Vector($A);
     $B = new Vector($B);
     $perpₐb = $A->perp($B);
     $expected = new Vector($expected);
     $this->assertEquals($expected, $perpₐb);
     $this->assertEquals($expected->getVector(), $perpₐb->getVector());
 }