internal static float GetLengthHelper(float dx, float dy, float dz)
        {
            if (!RhinoMath.IsValidSingle(dx) ||
                !RhinoMath.IsValidSingle(dy) ||
                !RhinoMath.IsValidSingle(dz))
            {
                return(0f);
            }

            float len;
            float fx = Math.Abs(dx);
            float fy = Math.Abs(dy);
            float fz = Math.Abs(dz);

            if (fy >= fx && fy >= fz)
            {
                len = fx; fx = fy; fy = len;
            }
            else if (fz >= fx && fz >= fy)
            {
                len = fx; fx = fz; fz = len;
            }

            // 15 September 2003 Dale Lear
            //     For small denormalized doubles (positive but smaller
            //     than DBL_MIN), some compilers/FPUs set 1.0/fx to +INF.
            //     Without the ON_DBL_MIN test we end up with
            //     microscopic vectors that have infinite length!
            //
            //     Since this code starts with doubles, none of this
            //     should be necessary, but it doesn't hurt anything.
            const float ON_SINGLE_MIN = (float)2.2250738585072014e-308;

            if (fx > ON_SINGLE_MIN)
            {
                len = 1f / fx;
                fy *= len;
                fz *= len;
                len = fx * (float)Math.Sqrt(1.0 + fy * fy + fz * fz);
            }
            else if (fx > 0.0 && RhinoMath.IsValidSingle(fx))
            {
                len = fx;
            }
            else
            {
                len = 0f;
            }
            return(len);
        }