/// <summary> /// /// </summary> /// <param name="indices"></param> /// <param name="field"></param> /// <param name="threshold"></param> /// <param name="weight"></param> public OnThreshold(IEnumerable <int> indices, GridScalarField3d field, double threshold, double weight = 1.0, int capacity = DefaultCapacity) : base(weight, capacity) { Handles.AddRange(indices.Select(i => new H(i))); Field = field; Threshold = threshold; }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { GH_Box box = null; if (!DA.GetData(0, ref box)) return; GH_Integer nx = null; if (!DA.GetData(1, ref nx)) return; GH_Integer ny = null; if (!DA.GetData(2, ref ny)) return; GH_Integer nz = null; DA.GetData(3, ref nz); List<GH_Number> vals = new List<GH_Number>(); DA.GetDataList(4, vals); if (nz == null) { var d = box.Value.BoundingBox.ToInterval2d(); var f = new GridScalarField2d(d, nx.Value, ny.Value, _wrapX, _wrapY, _sample); // set values if (vals != null) { if (vals.Count == 1) f.Set(vals[0].Value); else f.Set(vals.Select(x => x.Value)); } DA.SetData(0, new GH_ObjectWrapper(f)); } else { var d = box.Value.BoundingBox.ToInterval3d(); var f = new GridScalarField3d(d, nx.Value, ny.Value, nz.Value, _wrapX, _wrapY, _wrapZ, _sample); // set values if (vals != null) { if (vals.Count == 1) f.Set(vals[0].Value); else f.Set(vals.Select(x => x.Value)); } DA.SetData(0, new GH_ObjectWrapper(f)); } }
/// <summary> /// /// </summary> /// <param name="field"></param> /// <param name="threshold"></param> /// <param name="capacity"></param> /// <param name="weight"></param> public OnThreshold(GridScalarField3d field, double threshold, int capacity, double weight = 1.0) : base(capacity, weight) { Field = field; Threshold = threshold; }
/// <summary> /// /// </summary> /// <param name="field"></param> /// <param name="threshold"></param> /// <param name="capacity"></param> /// <param name="weight"></param> public OnThreshold(GridScalarField3d field, double threshold, double weight = 1.0, int capacity = DefaultCapacity) : base(weight, capacity) { Field = field; Threshold = threshold; }
/// <summary> /// /// </summary> /// <param name="field"></param> /// <param name="threshold"></param> /// <param name="weight"></param> public OnThreshold(GridScalarField3d field, double threshold, double weight = 1.0) : base(weight) { Field = field; Threshold = threshold; }