/// <summary> /// /// </summary> /// <param name="field"></param> /// <param name="point"></param> /// <param name="amount"></param> public static void IncrementAt(this GridField3d <Vector3d> field, ref GridPoint3d point, Vector3d amount) { var vals = field.Values; vals[point.Index0] += amount * point.Weight0; vals[point.Index1] += amount * point.Weight1; vals[point.Index2] += amount * point.Weight2; vals[point.Index3] += amount * point.Weight3; vals[point.Index4] += amount * point.Weight4; vals[point.Index5] += amount * point.Weight5; vals[point.Index6] += amount * point.Weight6; vals[point.Index7] += amount * point.Weight7; }
/// <summary> /// /// </summary> /// <param name="field"></param> /// <param name="point"></param> /// <param name="value"></param> public static void SetAt(this GridField3d <Vector3d> field, ref GridPoint3d point, Vector3d value) { var vals = field.Values; vals[point.Index0] += (value - vals[point.Index0]) * point.Weight0; vals[point.Index1] += (value - vals[point.Index1]) * point.Weight1; vals[point.Index2] += (value - vals[point.Index2]) * point.Weight2; vals[point.Index3] += (value - vals[point.Index3]) * point.Weight3; vals[point.Index4] += (value - vals[point.Index4]) * point.Weight4; vals[point.Index5] += (value - vals[point.Index5]) * point.Weight5; vals[point.Index6] += (value - vals[point.Index6]) * point.Weight6; vals[point.Index7] += (value - vals[point.Index7]) * point.Weight7; }
/// <inheritdoc /> public sealed override Vector3d ValueAt(ref GridPoint3d point) { var vals = Values; return (vals[point.Index0] * point.Weight0 + vals[point.Index1] * point.Weight1 + vals[point.Index2] * point.Weight2 + vals[point.Index3] * point.Weight3 + vals[point.Index4] * point.Weight4 + vals[point.Index5] * point.Weight5 + vals[point.Index6] * point.Weight6 + vals[point.Index7] * point.Weight7); }