コード例 #1
0
        /// <summary>
        /// Implements the - operator.
        /// </summary>
        /// <param name="a">a.</param>
        /// <param name="b">The b.</param>
        /// <returns>The result of the operator.</returns>
        /// <exception cref="ArgumentException">Stiffnesses must both be in local coordinate systems in order to be subtracted from each other.</exception>
        public static Stiffness operator -(Stiffness a, Stiffness b)
        {
            if (a == null)
            {
                return(b);
            }
            if (b == null)
            {
                return(a);
            }
            if (!a.IsLocalCoordinateSystem || !b.IsLocalCoordinateSystem)
            {
                throw new ArgumentException("Stiffnesses must both be in local coordinate systems in order to be subtracted from each other.");
            }

            Stiffness stiffness = new Stiffness()
            {
                U1 = a.U1 - b.U1,
                U2 = a.U2 - b.U2,
                U3 = a.U3 - b.U3,
                R1 = a.R1 - b.R1,
                R2 = a.R2 - b.R2,
                R3 = a.R3 - b.R3
            };

            return(stiffness);
        }
コード例 #2
0
        /// <summary>
        /// Implements the + operator.
        /// </summary>
        /// <param name="a">a.</param>
        /// <param name="b">The b.</param>
        /// <returns>The result of the operator.</returns>
        /// <exception cref="ArgumentException">Stiffnesses must both be in local coordinate systems in order to be added together.</exception>
        public static Stiffness operator +(Stiffness a, Stiffness b)
        {
            if (a == null)
            {
                return(b);
            }
            if (b == null)
            {
                return(a);
            }
            if (!a.IsLocalCoordinateSystem || !b.IsLocalCoordinateSystem)
            {
                throw new ArgumentException("Stiffnesses must both be in local coordinate systems in order to be added together.");
            }

            Stiffness stiffness = new Stiffness()
            {
                U1 = a.U1 + b.U1,
                U2 = a.U2 + b.U2,
                U3 = a.U3 + b.U3,
                R1 = a.R1 + b.R1,
                R2 = a.R2 + b.R2,
                R3 = a.R3 + b.R3
            };

            return(stiffness);
        }