private void AddElement2d(MeshBuilder bldr, Element2D elm) { if (elm.Nodes.Length == 4) { var p1 = elm.Nodes[0].Location; var p2 = elm.Nodes[1].Location; var p3 = elm.Nodes[2].Location; var p4 = elm.Nodes[3].Location; bldr.AddTriangle(p1, p2, p3); bldr.AddTriangle(p1, p3, p4); } if (elm.Nodes.Length == 3) { var p1 = elm.Nodes[0].Location; var p2 = elm.Nodes[1].Location; var p3 = elm.Nodes[2].Location; bldr.AddTriangle(p1, p2, p3); } }
private void AddElement3D(MeshBuilder bldr, Element3D elm) { if (elm.Nodes.Length == 8) { //brick var p = new Func <Node, Point>(i => i.Location); var sides = new int[][] { new int[] { 1, 2, 6 }, new int[] { 1, 5, 6 }, new int[] { 2, 6, 3 }, new int[] { 7, 6, 3 }, new int[] { 4, 3, 7 }, new int[] { 4, 8, 7 }, new int[] { 1, 4, 8 }, new int[] { 1, 5, 8 }, new int[] { 5, 6, 7 }, new int[] { 5, 8, 7 }, new int[] { 1, 2, 3 }, new int[] { 1, 4, 3 }, }; foreach (var side in sides) { bldr.AddTriangle(p(elm.Nodes[side[0] - 1]), p(elm.Nodes[side[1] - 1]), p(elm.Nodes[side[2] - 1])); } } }
private void AddTetrahedronElement(MeshBuilder bldr, Tetrahedral elm) { PolygonYz section = null; var r = ElementVisualThickness / 2; var p1 = elm.Nodes[0].Location; var p2 = elm.Nodes[1].Location; var p3 = elm.Nodes[2].Location; var p4 = elm.Nodes[3].Location; bldr.AddTriangle(p1, p3, p4); bldr.AddTriangle(p3, p2, p4); bldr.AddTriangle(p1, p2, p4); bldr.AddTriangle(p1, p2, p3); }
private void AddTrussElement(MeshBuilder bldr, TrussElement2Node elm) { PolygonYz section = null; var r = ElementVisualThickness / 2; if (elm.UseOverridedProperties) { section = new PolygonYz( new PointYZ(-r, -r), new PointYZ(-r, r), new PointYZ(r, r), new PointYZ(r, -r), new PointYZ(-r, -r)); } else { section = elm.Geometry; } for (var i = 0; i < section.Count - 1; i++) { var v1 = new Vector(0, section[i].Y, section[i].Z); var v2 = new Vector(0, section[i + 1].Y, section[i + 1].Z); var p1 = elm.StartNode.Location + elm.TransformLocalToGlobal(v1); var p2 = elm.StartNode.Location + elm.TransformLocalToGlobal(v2); var v = elm.EndNode.Location - elm.StartNode.Location; if (Math.Abs(v.Z) < 0.01) { Guid.NewGuid(); } var p3 = p1 + v; var p4 = p2 + v; bldr.AddTriangle(p1, p3, p2); bldr.AddTriangle(p4, p2, p3); } }
private void AddCstElement(MeshBuilder bldr, CstElement elm) { PolygonYz section = null; var r = ElementVisualThickness / 2; var p1 = elm.Nodes[0].Location; var p2 = elm.Nodes[1].Location; var p3 = elm.Nodes[2].Location; bldr.AddTriangle(p1, p3, p2); }