public static FEMesh OrientTowards(this FEMesh mesh, Point orientationPoint) { if (mesh.IsNull() || orientationPoint.IsNull()) { return(null); } FEMesh clone = mesh.ShallowClone(); clone.Faces = clone.Faces.Select(x => x.OrientTowards(mesh, orientationPoint)).ToList(); return(clone); }
public static FEMesh SetLocalOrientations(this FEMesh mesh, Vector localX) { if (mesh.IsNull() || localX.IsNull()) { return(null); } FEMesh clone = mesh.ShallowClone(); clone.Faces = clone.Faces.Select(x => x.SetLocalOrientation(mesh, localX)).ToList(); return(clone); }
public static FEMeshFace OrientTowards(this FEMeshFace face, FEMesh mesh, Point orientationPoint) { if (face.IsNull() || mesh.IsNull() || orientationPoint.IsNull()) { return(null); } Point centre = face.NodeListIndices.Select(i => mesh.Nodes[i].Position).Average(); Vector localX = (orientationPoint - centre).Normalise(); return(face.SetLocalOrientation(mesh, localX)); }
public static List <Panel> FEMeshToPanel(this FEMesh feMesh) { if (feMesh.IsNull()) { return(null); } if (feMesh.Nodes.Count < 3) { Reflection.Compute.RecordError("Insufficient number of nodes to be able to convert FEMesh to a Panel."); return(null); } if (feMesh.Faces.Count < 1) { Reflection.Compute.RecordError("At least one FEFace required to construct a Panel from FEMesh."); return(null); } List <Polyline> polylines = new List <Polyline>(); foreach (FEMeshFace feMeshFace in feMesh.Faces) { List <Point> points = new List <Point>(); foreach (int nodeIndex in feMeshFace.NodeListIndices) { points.Add(feMesh.Nodes[nodeIndex].Position); } points.Add(feMesh.Nodes[feMeshFace.NodeListIndices.First()].Position); polylines.Add(Geometry.Create.Polyline(points)); } List <Panel> panels = new List <Panel>(); Panel panel = new Panel(); foreach (Polyline polyline in polylines) { panel = Create.Panel(polyline, null, null, feMesh.Name); if (feMesh.Property != null) { panel.Property = feMesh.Property; } if (feMesh.Fragments.Count > 0) { panel.Fragments = feMesh.Fragments; } if (feMesh.Tags.Count > 0) { panel.Tags = feMesh.Tags; } panels.Add(panel); } return(panels); }
public static bool IsNull(this FEMeshFace face, FEMesh mesh, string msg = "", [CallerMemberName] string methodName = "Method") { // Check FEMeshFace and relevant nodes in FEMesh if (face.IsNull(msg, methodName)) { return(true); } else if (mesh.IsNull(false, true, face.NodeListIndices, msg, methodName)) { return(true); } return(false); }
public static FEMeshFace SetLocalOrientation(this FEMeshFace face, FEMesh mesh, Vector localX) { if (face.IsNull() || mesh.IsNull() || localX.IsNull()) { return(null); } FEMeshFace clone = face.ShallowClone(); Vector normal = face.Normal(mesh); double orientationAngle = Compute.OrientationAngleAreaElement(normal, localX); if (!double.IsNaN(orientationAngle)) { clone.OrientationAngle = orientationAngle; } return(clone); }
public static List <Point> PointGrid(this FEMeshFace face, FEMesh mesh) { if (face.IsNull() || mesh.IsNull()) { return(null); } List <Point> pts = face.NodeListIndices.Select(i => mesh.Nodes[i].Position).ToList(); List <Point> temp = new List <Point>(); for (int i = 0; i < pts.Count; i++) { int next = (i + 1) % pts.Count; temp.Add((pts[i] + pts[next]) / 2); } pts.AddRange(temp); pts.Add(pts.Average()); return(pts); }
public static double Area(this FEMesh mesh) { return(mesh.IsNull() ? 0 : Analytical.Query.Geometry(mesh).Area()); }
public static List <List <Point> > PointGrid(this FEMesh mesh) { return(mesh.IsNull() ? null : mesh.Faces.Select(x => x.PointGrid(mesh)).ToList()); }
public static List <Vector> Normals(this FEMesh mesh) { return(mesh.IsNull() ? null : mesh.Faces.Select(x => x.Normal(mesh)).ToList()); }
public static List <Basis> LocalOrientations(this FEMesh mesh) { return(mesh.IsNull() ? null : mesh.Faces.Select(x => x.LocalOrientation(mesh)).ToList()); }
public static List <Cartesian> CoordinateSystem(this FEMesh mesh) { return(mesh.IsNull() ? null : mesh.Faces.Select(x => x.CoordinateSystem(mesh)).ToList()); }