/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { Mp.Noise noise = new Mp.Noise(); if (!DA.GetData(0, ref noise)) { ; } noise = new Mp.Noise(noise); int mode = 0; DA.GetData(1, ref mode); int octaves = 5; DA.GetData(2, ref octaves); double lacunity = 2.0; DA.GetData(3, ref lacunity); double gain = 0.5; DA.GetData(4, ref gain); noise.IsFractal = true; noise.FractalMode = (Mp.Noise.FractalModes)mode; noise.Octaves = octaves; noise.Lacunarity = lacunity; noise.Gain = gain; DA.SetData(0, new Image(noise.GetCurrent())); DA.SetData(1, new Mp.Noise(noise)); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { int seed = 1; int width = 100; int height = 100; int depth = 1; DA.GetData(0, ref seed); DA.GetData(1, ref width); DA.GetData(2, ref height); DA.GetData(3, ref depth); int mode = 0; DA.GetData(4, ref mode); int interp = 0; DA.GetData(5, ref interp); double frequency = 0.25; DA.GetData(6, ref frequency); Mp.Noise noise = new Mp.Noise(seed, width, height, depth); noise.InterpolationMode = (Mp.Noise.InterpolationModes)interp; noise.Frequency = frequency; switch (mode) { case 1: DA.SetData(0, new Image(noise.GetPerlin())); break; case 2: DA.SetData(0, new Image(noise.GetCubic())); break; case 3: DA.SetData(0, new Image(noise.GetSimplex())); break; case 4: DA.SetData(0, new Image(noise.GetWhiteNoise())); break; default: DA.SetData(0, new Image(noise.GetValue())); break; } DA.SetData(1, new Mp.Noise(noise)); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { int seed = 1; int width = 100; int height = 100; int depth = 1; DA.GetData(0, ref seed); DA.GetData(1, ref width); DA.GetData(2, ref height); DA.GetData(3, ref depth); int mode = 0; DA.GetData(4, ref mode); int output = 0; DA.GetData(5, ref output); double jitter = 0.5; DA.GetData(6, ref jitter); double frequency = 0.25; DA.GetData(7, ref frequency); Interval interval = new Interval(0, 1); DA.GetData(8, ref interval); Mp.Noise noise = new Mp.Noise(seed, width, height, depth); noise.CellularMode = (Mp.Noise.CellularModes)mode; noise.CellularOutput = (Mp.Noise.CellularOutputs)output; noise.Jitter = jitter; noise.Frequency = frequency; noise.Index0 = (int)interval.T0; noise.Index1 = (int)interval.T1; DA.SetData(0, new Image(noise.GetCellular())); DA.SetData(1, new Mp.Noise(noise)); }