// -------------------------------------------------------------------------- // Project Frocessing // ActionScript 3.0 drawing library like Processing. // -------------------------------------------------------------------------- // // This library is based on Processing.(http://processing.org) // Copyright (c) 2004-08 Ben Fry and Casey Reas // Copyright (c) 2001-04 Massachusetts Institute of Technology // // Frocessing drawing library // Copyright (C) 2008-10 TAKANAWA Tomoaki (http://nutsu.com) and // Spark project (www.libspark.org) // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // contact : face(at)nutsu.com // package frocessing.math { /** * Perlin Noise を生成するメソッドを提供します. * * @author nutsu * @version 0.6 */ public class PerlinNoise { private static const PERLIN_YWRAPB :int = 4; private static const PERLIN_YWRAP :int = 1<=1.0 ) { xi++; xf--; } if (yf>=1.0 ) { yi++; yf--; } if (zf>=1.0 ) { zi++; zf--; } } return r; //return ( r < 1 ) ? r : 1; } /** * set random seed. * @param seed */ public function noiseSeed( seed:uint ):void { if (__random == null) __random = new SFMTRandom( seed ); else __random.randomSeed( seed ); __perlin = null; } /** * note that fallout value greater than 0.5 might result in greater than 1.0 values returned by noise(). * @param lod * @param falloff */ public function noiseDetail( lod:uint, falloff:Number=0):void { if (lod > 0) perlin_octaves = lod; if (falloff > 0 ) perlin_amp_falloff = ( falloff > 1 ) ? 1 : falloff; } } }