예제 #1
0
        public static KInt2 ToInt2(KInt x, KInt y)
        {
            KInt2 value = new KInt2();

            value._x = x.IntValue * divscale / KInt.divscale;
            value._y = y.IntValue * divscale / KInt.divscale;
            return(value);
        }
예제 #2
0
        public static KInt3 ToInt3(KInt x, KInt y, KInt z)
        {
            KInt3 value = new KInt3();

            value._x = x.IntValue / KInt.divscale * divscale;
            value._y = y.IntValue / KInt.divscale * divscale;
            value._z = z.IntValue / KInt.divscale * divscale;
            return(value);
        }
예제 #3
0
        bool isAllLine(List <KInt2> linequeue)
        {
            if (linequeue.Count <= 2)
            {
                return(true);
            }

            KInt2 firstdir = linequeue [1] - linequeue [0];

            for (int i = 1; i < linequeue.Count - 1; ++i)
            {
                KInt2 current = linequeue [i];
                KInt2 next    = linequeue [i + 1];
                KInt  det     = RVOMath.det(next - current, firstdir);
                if (det != 0)
                {
                    return(false);
                }
            }
            return(true);
        }