Project 2:
Electric Wiring
Bill is designing electric wiring for his
new house.
First of all, he has fixed the
positions of several electrical outlets on the
walls.
To neatly connect any pair of outlets,
he would make sure that the wire is always
imbedded in the walls or the floor, and is
parallel to at least one side of the wall.
Naturally he wants to minimize the total
length of wire he must buy to have all the
outlets connected.
By the way, do not forget that there is a door for every room. The wire must not
cross the door.
Figure 1 shows a possible setting in a room with 4 outlets.
Input Specification:
Your program must read test cases from a file “
input.txt
”.
The input file
consists of several test cases.
For each test case, the first line contains 4 triples (
x
1
,
y
1
,
z
1
) .
.. (
x
4
,
y
4
,
z
4
) which are the coordinates of the four corners of a rectangular door.
The second line contains size of the room, (L
x
, L
y
, L
z
), and a positive integer
N
(<=20).
Then
N
lines of coordinates (
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Winter '08
 YueChen
 Cartesian Coordinate System, René Descartes, Cartesian product

Click to edit the document details