public override _1DCrossSectionGeometricProperties GetCrossSectionPropertiesAt(double xi)
        {
            if (sectionAtStart.Length != sectionAtEnd.Length)
            {
                throw new InvalidOperationException();
            }

            var n = sectionAtStart.Length;

            var target = new PointYZ[n];

            var s1 = (1.0 - xi) / 2.0;
            var s2 = (1.0 + xi) / 2.0;


            for (var i = 0; i < n; i++)
            {
                var pt = new PointYZ();

                pt.Y = sectionAtStart[i].Y * s1 + sectionAtEnd[i].Y * s2;
                pt.Z = sectionAtStart[i].Z * s1 + sectionAtEnd[i].Z * s2;

                target[i] = pt;
            }

            var _geometry = target;

            return(_1DCrossSectionGeometricProperties.Calculate(target, this._resetCentroid));
        }
예제 #2
0
        public override _1DCrossSectionGeometricProperties GetCrossSectionPropertiesAt(double xi)
        {
            var target = new _1DCrossSectionGeometricProperties();

            var s1 = sectionAtStart;
            var s2 = sectionAtStart;

            {
                var f1 = (1.0 - xi) / 2.0;
                var f2 = (1.0 + xi) / 2.0;

                var pt = new PointYZ();

                target.A  = s1.A * f1 + s2.A * f2;
                target.Ay = s1.Ay * f1 + s2.Ay * f2;
                target.Az = s1.Az * f1 + s2.Az * f2;
                target.J  = s1.J * f1 + s2.J * f2;
                target.Iy = s1.Iy * f1 + s2.Iy * f2;
                target.Iz = s1.Iz * f1 + s2.Iz * f2;
            }

            return(target);
        }
예제 #3
0
        public override _1DCrossSectionGeometricProperties GetCrossSectionPropertiesAt(double xi)
        {
            if (sectionAtStart.Length != sectionAtEnd.Length)
            {
                throw new InvalidOperationException();
            }

            var n = sectionAtStart.Length;

            var target = new PointYZ[n];

            var s1 = (1.0 - xi) / 2.0;
            var s2 = (1.0 + xi) / 2.0;


            for (var i = 0; i < n; i++)
            {
                var pt = new PointYZ();

                pt.Y = sectionAtStart[i].Y * s1 + sectionAtEnd[i].Y * s2;
                pt.Z = sectionAtStart[i].Z * s1 + sectionAtEnd[i].Z * s2;

                target[i] = pt;
            }


            var _geometry = target;
            var buf       = new _1DCrossSectionGeometricProperties();

            {
                var lastPoint = _geometry[_geometry.Length - 1];

                if (lastPoint != _geometry[0])
                {
                    throw new InvalidOperationException("First point and last point ot PolygonYz should put on each other");
                }

                double a = 0.0, iz = 0.0, iy = 0.0, ixy = 0.0;

                var x = new double[_geometry.Length];
                var y = new double[_geometry.Length];

                for (int i = 0; i < _geometry.Length; i++)
                {
                    x[i] = _geometry[i].Y;
                    y[i] = _geometry[i].Z;
                }

                var l = _geometry.Length - 1;

                var ai = 0.0;

                for (var i = 0; i < l; i++)
                {
                    ai  = x[i] * y[i + 1] - x[i + 1] * y[i];
                    a  += ai;
                    iy += (y[i] * y[i] + y[i] * y[i + 1] + y[i + 1] * y[i + 1]) * ai;
                    iz += (x[i] * x[i] + x[i] * x[i + 1] + x[i + 1] * x[i + 1]) * ai;

                    ixy += (x[i] * y[i + 1] + 2 * x[i] * y[i] + 2 * x[i + 1] * y[i + 1] + x[i + 1] * y[i]) * ai;
                }

                a   = a * 0.5;
                iz  = iz * 1 / 12.0;
                iy  = iy * 1 / 12.0;
                ixy = ixy * 1 / 24.0;
                var j = iy + iz;
                //not sure which one is correct j = ix + iy or j = ixy >:)~

                buf.A  = Math.Abs(a);
                buf.Iz = Math.Abs(iz);
                buf.Iy = Math.Abs(iy);
                buf.J  = Math.Abs(j);
                buf.Ay = Math.Abs(a); //TODO: Ay is not equal to A, this is temporary fix
                buf.Az = Math.Abs(a); //TODO: Az is not equal to A, this is temporary fix
            }

            return(buf);
        }