本文整理汇总了PHP中Math::angleBetween方法的典型用法代码示例。如果您正苦于以下问题:PHP Math::angleBetween方法的具体用法?PHP Math::angleBetween怎么用?PHP Math::angleBetween使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math
的用法示例。
在下文中一共展示了Math::angleBetween方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAngleBetween
/**
* @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: angleBetweenPoints
/**
* 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);
}