Exemplo n.º 1
0
 public function ringSectorProvider()
 {
     $a1 = Angle::byDegrees(45);
     $a2 = Angle::byDegrees(135);
     $l1 = sin(\deg2rad(45)) * 100;
     $l2 = $l1 / 2;
     return array(array([[10 + $l1, 20 + $l1], [10 - $l1, 20 + $l1], [10 - $l2, 20 + $l2], [10 + $l2, 20 + $l2]], Points::ringSector(Point::create(10, 20), $a1, $a2, 100, 50)), array([[10 - $l1, 20 + $l1], [10 + $l1, 20 + $l1], [10 + $l2, 20 + $l2], [10 - $l2, 20 + $l2]], Points::ringSector(Point::create(10, 20), $a1, $a2, 100, 50, true)));
 }
Exemplo n.º 2
0
 /**
  * @dataProvider skewYProvider
  */
 public function testSkewY($x, $y, $cx, $cy, $degrees, $expectedX, $expectedY)
 {
     $this->assertEqualCoordinates($expectedX, $expectedY, Point::create($x, $y)->skewY(Point::create($cx, $cy), Angle::byDegrees($degrees)));
 }
Exemplo n.º 3
0
 public static function rotated(Point $center, $n, $pointsArray, $ccw = false)
 {
     $points = new Points($center, false);
     $delta = deg2rad(360) / $n;
     $angle = Angle::create(0);
     for ($i = 0; $i < $n; $i++) {
         foreach ($pointsArray as $point) {
             $points->addPoint($point)->rotate($center, $angle);
         }
         $angle->add($delta);
     }
     $points->reverseIfCcw($ccw);
     return $points;
 }