Example #1
0
        protected static Point CenterOfGravity(AbstractElement element)
        {
            var cg    = new Point();
            var nodes = element.Nodes;

            cg.X = nodes[0].Coordinates[0];
            cg.Y = nodes[0].Coordinates[1];

            cg.X += 0.5 * (nodes[1].Coordinates[0] - cg.X);
            cg.Y += 0.5 * (nodes[1].Coordinates[1] - cg.Y);

            return(cg);
        }
Example #2
0
        protected static Point CenterOfGravity(AbstractElement element)
        {
            var cg    = new Point();
            var nodes = element.Nodes;

            cg.X = 0;
            for (var i = 0; i < element.Nodes.Length; i++)
            {
                cg.X += nodes[i].Coordinates[0];
                cg.Y += nodes[i].Coordinates[1];
            }
            cg.X /= 4.0;
            cg.Y /= 4.0;
            return(cg);
        }