Beispiel #1
0
        public static Point Vector3DToISO(Vector3D v)
        {
            int x = 0, y = 0;

            x = (int)(1 * v.getX() + -1 * v.getY() + 0 * v.getZ());
            y = (int)(0.5 * v.getX() + 0.5 * v.getY() + -1 * v.getZ());

            return new Point(x, y);
        }
Beispiel #2
0
        private bool isInsideField(int x, int y, Vector3D v)
        {
            if (x < 0 || x > size) throw new ArgumentException();
            if (y < 0 || y > size) throw new ArgumentException();
            bool ret = false;

            Vector3D basePoint = this.getBasePoint();

            // up left
            Vector3D field1 = new Vector3D(x * RECTSIZE, y * RECTSIZE, 0);
            // down right
            Vector3D field2 = new Vector3D(x * RECTSIZE + RECTSIZE, y * RECTSIZE + RECTSIZE, 0);

            if (v.getX() >= (basePoint + field1).getX() && v.getX() <= (basePoint + field1).getX() + RECTSIZE) {
                if (v.getY() >= (basePoint + field1).getY() && v.getY() <= (basePoint + field1).getY() + RECTSIZE) {
                    if (v.getZ() == (basePoint + field1).getZ()) {
                        return ret = true;
                    }
                }
            }

            return ret;
        }
Beispiel #3
0
        public bool isInside(Vector3D v)
        {
            Vector3D basePoint = this.getBasePoint();
            int length = RECTSIZE * size;

            if (v.getX() >= basePoint.getX() && v.getX() <= basePoint.getX() + length) {
                if (v.getY() >= basePoint.getY() && v.getY() <= basePoint.getY() + length) {
                    if (v.getZ() == basePoint.getZ()) {
                        return true;
                    }
                }
            }

            return false;
        }