/// <summary> /// <para>Warning: easy way to get a <see cref="OutOfMemoryException"/></para> /// Generates an hypercube of values within a specified range based on the coordinates of the specified start values. /// </summary> /// <param name="module"><see cref="IModule4D"/> represent the noise generator.</param> /// <param name="width">The width of the hypercube (x-axis).</param> /// <param name="height">The height of the hypercube (y-axis).</param> /// <param name="depth">The depth" of the hypercube (z-axis).</param> /// <param name="time">The time of the hypercube (w-axis).</param> /// <param name="scaleFactor">The scale factor of the hypercube.</param> /// <param name="range">Target range to convert the hypercube.</param> /// <param name="start_x">The start coordinate on the x-axis.</param> /// <param name="start_y">The start coordinate on the y-axis.</param> /// <param name="start_z">The start coordinate on the z-axis.</param> /// <param name="start_w">The start coordinate on the w-axis.</param> /// <returns>The resulting hypercube in target range.</returns> static public float[,,,] GetHypercube(this IModule4D module, int width, int height, int depth, int time, float scaleFactor, NoiseRange range, int start_x, int start_y, int start_z, int start_w) { float[,,,] rslt = new float[width, height, depth, time]; for (int w = 0; w < width; w++) { for (int h = 0; h < height; h++) { for (int d = 0; d < depth; d++) { for (int t = 0; t < time; t++) { rslt[w, h, d, t] = module.GetValue((start_x + w) * scaleFactor, (start_y + h) * scaleFactor, (start_z + d) * scaleFactor, (start_w + t) * scaleFactor, range); } } } } return(rslt); }
/// <summary> /// Generates an output value within a specified range based on the coordinates of the specified inputs values. /// </summary> /// <param name="module"><see cref="IModule4D"/> represent the noise generator.</param> /// <param name="x">The input coordinate on the x-axis.</param> /// <param name="y">The input coordinate on the y-axis.</param> /// <param name="z">The input coordinate on the z-axis.</param> /// <param name="w">The input coordinate on the w-axis.</param> /// <param name="range">Target range to convert the output value.</param> /// <returns>The resulting output value in target range.</returns> static public float GetValue(this IModule4D module, float x, float y, float z, float w, NoiseRange range) { return(ToRange(module.GetValue(x, y, z, w), range)); }