/// <summary> /// Evaluate noise /// </summary> /// <param name="p">point</param> /// <returns>function value</returns> public double Eval(Point3 p) { var result = 0.0; foreach (var m in mult) { result += m * ImprovedNoise.noise(p.x, p.y, p.z); p = p * 2; } var r = (result / sum + 1) / 2; return(r); }
/// <summary> /// Evaluate noise /// </summary> /// <param name="p">point</param> /// <returns>function value</returns> public Vector3 Eval(Point3 p) { double x = 0.0, y = 0.0, z = 0.0; foreach (var m in mult) { x += m * ImprovedNoise.noise(p.x, p.y, p.z); y += m * ImprovedNoise.noise(p.z, p.x, p.y); z += m * ImprovedNoise.noise(p.y, p.z, p.x); p = p * 2; } var v = new Vector3(x, y, z); return(v); }
/// <summary> /// Rectified perlin noise /// </summary> /// <param name="p"></param> /// <returns>function value</returns> public static double PerlinRidged(Point3 p) { var r = ImprovedNoise.noise(p.x, p.y, p.z); return(Math.Abs(r)); }
/// <summary> /// Basic perlin noise /// </summary> /// <param name="p"></param> /// <returns>function value</returns> public static double Perlin(Point3 p) { var r = ImprovedNoise.noise(p.x, p.y, p.z); return(r / 2 + 0.5); }
/// <summary> /// Good old Perlin noise /// </summary> /// <param name="p">point</param> /// <returns>function value</returns> public static Vector3 Perlin(Point3 p) { return(ImprovedNoise.noiseVector(p.x, p.y, p.z)); }