示例#1
0
        private Point In_front_of(Room room, Room.Gate door)
        {
            Point middle = new Point()
            {
                X = (door.Line.X1 + door.Line.X2) / 2, Y = (door.Line.Y1 + door.Line.Y2) / 2
            };
            double gradient = -(door.Line.X1 - door.Line.X2) / (door.Line.Y1 - door.Line.Y2);

            Point in_front_of_door = Algorithm.Away_point_to(middle, gradient, 10);

            if (Algorithm.Is_inside(room, in_front_of_door))
            {
                in_front_of_door = Algorithm.Away_point_to(middle, gradient, -10);
            }

            return(in_front_of_door);
        }
示例#2
0
        private ModelVisual3D MakeGate(Room.Gate source)
        {
            String   type    = source.Type;
            String   datasrc = source.ModelSource;
            Vector3D position;
            Vector3D scale;
            Double   angle = Math.Atan2(source.Line.X2 - source.Line.X1, source.Line.Y2 - source.Line.Y1) * (180 / Math.PI);

            switch (type)
            {
            case "Door":
                position = new Vector3D((source.Line.Y1 + source.Line.Y2) / 2, (source.Line.X1 + source.Line.X2) / 2, 0);
                scale    = new Vector3D(1, 1, 1);
                return(Convert3D(position, angle, scale, datasrc));

            case "Window":
                position = new Vector3D((source.Line.Y1 + source.Line.Y2) / 2, (source.Line.X1 + source.Line.X2) / 2, 70);
                scale    = new Vector3D(0.7, 0.7, 0.7);
                return(Convert3D(position, angle, scale, datasrc));

            default:
                throw new Exception();
            }
        }