Ejemplo n.º 1
0
 public function __construct(Random $random, $octaves, $persistence, $expansion = 1)
 {
     parent::__construct($random, $octaves, $persistence, $expansion);
     $this->offsetW = $random->nextFloat() * 256;
     self::$SQRT_3 = sqrt(3);
     self::$SQRT_5 = sqrt(5);
     self::$F2 = 0.5 * (self::$SQRT_3 - 1);
     self::$G2 = (3 - self::$SQRT_3) / 6;
     self::$G22 = self::$G2 * 2.0 - 1;
     self::$F3 = 1.0 / 3.0;
     self::$G3 = 1.0 / 6.0;
     self::$F4 = (self::$SQRT_5 - 1.0) / 4.0;
     self::$G4 = (5.0 - self::$SQRT_5) / 20.0;
     self::$G42 = self::$G4 * 2.0;
     self::$G43 = self::$G4 * 3.0;
     self::$G44 = self::$G4 * 4.0 - 1.0;
 }
Ejemplo n.º 2
0
 public function __construct(Random $random, $octaves, $frequency, $amplitude)
 {
     parent::__construct($random, $octaves, $frequency, $amplitude);
     $this->offsetW = $random->nextFloat() * 256;
     self::$SQRT_3 = \sqrt(3);
     self::$SQRT_5 = \sqrt(5);
     self::$F2 = 0.5 * (self::$SQRT_3 - 1);
     self::$G2 = (3 - self::$SQRT_3) / 6;
     self::$G22 = self::$G2 * 2.0 - 1;
     self::$F3 = 1.0 / 3.0;
     self::$G3 = 1.0 / 6.0;
     self::$F4 = (self::$SQRT_5 - 1.0) / 4.0;
     self::$G4 = (5.0 - self::$SQRT_5) / 20.0;
     self::$G42 = self::$G4 * 2.0;
     self::$G43 = self::$G4 * 3.0;
     self::$G44 = self::$G4 * 4.0 - 1.0;
 }