示例#1
0
文件: MathTest.php 项目: tarcisio/p2d
 /**
  * @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);
 }
示例#2
0
文件: Line.php 项目: tarcisio/p2d
 public function angle()
 {
     return Math::angleBetweenPoints($this->start, $this->end);
 }