Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        public static FEMesh Transform(this FEMesh mesh, TransformMatrix transform, double tolerance = Tolerance.Distance)
        {
            if (!transform.IsRigidTransformation(tolerance))
            {
                BH.Engine.Reflection.Compute.RecordError("Transformation failed: only rigid body transformations are currently supported.");
                return(null);
            }

            FEMesh result = mesh.ShallowClone();

            result.Nodes = result.Nodes.Select(x => x.Transform(transform, tolerance)).ToList();

            List <Basis> orientationsBefore = mesh.LocalOrientations();

            result.Faces = new List <FEMeshFace>(mesh.Faces);
            for (int i = 0; i < orientationsBefore.Count; i++)
            {
                result.Faces[i] = result.Faces[i].SetLocalOrientation(result, orientationsBefore[i].Transform(transform).X);
            }

            return(result);
        }