public LBMElement(SerializationInfo info, StreamingContext ctxt) { this._x = (float)info.GetValue("_x", typeof(float)); this._y = (float)info.GetValue("_y", typeof(float)); this._density = (float)info.GetValue("_density", typeof(float)); this.nodeType = (LBMNodeType)info.GetValue("nodeType", typeof(byte)); }
public static void DrawLineLBM(LBMElement[,] tabLBM, int elementSize, int x1, int y1, int x2, int y2, LBMNodeType nodeType) { float xDiff = (x2 - x1); float yDiff = (y2 - y1); float x = x1; float y = y1; float minSteps = Math.Max(Math.Abs(xDiff), Math.Abs(yDiff)); minSteps = minSteps == 0 ? 1 : minSteps; for (int i = 0; i <= minSteps; i++) { x += xDiff / minSteps; y += yDiff / minSteps; tabLBM[(int)Math.Round(x / elementSize), (int)Math.Round(y / elementSize)].nodeType = nodeType; } }
public LBMElement() { x = y = 0f; _density = 1f; nodeType = 0; }