Example #1
0
 public function DrawLine(ALiVE_2D_Vector $a, ALiVE_2D_Vector $b, ALiVE_Colour $colour)
 {
     for ($tween = 0; $tween < 1; $tween += 0.09) {
         $x = ALiVE_Tween($a->X(), $b->X(), $tween);
         $y = ALiVE_Tween($a->Y(), $b->Y(), $tween);
         if (isset($prevx) && isset($prevy)) {
             $v = new ALiVE_2D_Vector($x, $y);
             if ($x - $prevx < 0.01) {
                 $this->FillPoint($v, '|');
             } else {
                 if ($y - $prevy < 0.01) {
                     $this->FillPoint($v, '_');
                 } else {
                     if ($y - $prevy - $x + $prevx < 0.01) {
                         $this->FillPoint($v, '\\');
                     } else {
                         if ($y - $prevy + $x - $prevx < 0.01) {
                             $this->FillPoint($v, '/');
                         } else {
                             $this->FillPoint($v, '.');
                         }
                     }
                 }
             }
         }
         $prevx = $x;
         $prevy = $y;
     }
 }
Example #2
0
File: gd.php Project: eXcomm/alive
 private function TransformPoint(ALiVE_2D_Vector $point)
 {
     // 0       W-1
     // . . . . .
     //-1   0  +1
     // (W - 1) / 2 + x * ((W - 1) / 2)
     $x = ($this->mWidth - 1) / 2 + $point->X() * (($this->mWidth - 1) / 2);
     $y = ($this->mHeight - 1) / 2 + $point->Y() * (($this->mHeight - 1) / 2);
     return new ALiVE_2D_Vector($x, $y);
 }