Example #1
0
 /**
  * @covers tarcisio\p2d\Math::angleBetween
  * @covers tarcisio\p2d\Math::angleBetweenPoints
  */
 public function testAngleBetween()
 {
     $p1 = new Point(0, 0);
     $p2 = new Point(20, 20);
     $this->assertEquals(0.785398163, Math::angleBetween($p1->x, $p1->y, $p2->x, $p2->y), '', 0.001);
     $this->assertEquals(0.785398163, Math::angleBetweenPoints($p1, $p2), '', 0.001);
 }
Example #2
0
 /**
  * Find the angle of a segment from $p1 -> $p2 in radians
  */
 public static function angleBetweenPoints($p1, $p2)
 {
     return Math::angleBetween($p1->x, $p1->y, $p2->x, $p2->y);
 }