コード例 #1
0
        protected static Vec Div(Vec v, float scalar)
        {
            Vec result = v.Clone();

            for (int i = 0; i < result.components.Length; ++i)
            {
                result.components[i] /= scalar;
            }
            return(result);
        }
コード例 #2
0
        protected static Vec Div(Vec v1, Vec v2)
        {
            Vec result;
            Vec operand;
            int size;

            if (v1.components.Length > v2.components.Length)
            {
                result  = v1.Clone();
                operand = v2;
                size    = v2.components.Length;
            }
            else
            {
                result  = v2.Clone();
                operand = v1;
                size    = v1.components.Length;
            }
            for (int i = 0; i < size; ++i)
            {
                result.components[i] /= operand.components[i];
            }
            return(result);
        }
コード例 #3
0
        protected Vec Div(Vec v)
        {
            Vec result;
            Vec operand;
            int size;

            if (v.components.Length > components.Length)
            {
                result  = v.Clone();
                operand = this;
                size    = components.Length;
            }
            else
            {
                result  = Clone();
                operand = v;
                size    = v.components.Length;
            }
            for (int i = 0; i < size; ++i)
            {
                result.components[i] /= operand.components[i];
            }
            return(result);
        }