If the Shoe Fits
So you heard that the theater folks could use a good hack now and
again. You took the class, and by now you've managed some pretty
spectacular set hacks, but your fingers are itching for a keyboard.
The next production is \textit{Into the Woods}, and one of the big
effects scenes occurs when the prince comes to Cinderella's
house with the slipper. As everyone knows, the evil step-sisters are
going to have their toes chopped off. The teacher has decided that
they should pretend to cut the correct toes, but they really can't
figure out which ones must go.
Eh, why not?
Write a program to calculate which toes must be removed for the shoe
to fit.
Each toe is modeled as an ellipse. The toes' bottoms are aligned on a
baseline which is also an axis of the ellipse modelling the shoe's
toe. The images of the toes along this line do not overlap but
do form a continuous line. In other words, the toes are side-by-side
but not necessarily flush against each other. The toes are also
centered in the shoe. See
figure~\ref{fig:foot} for an illustration.
\begin{figure}[h!b]
\centering
%\begin{minipage}{.4\linewidth}
\unitlength = 2.5pt
\begin{picture}(90,40)(-10,-6)
\put(5,7.5){\ellipse{10}{15}}
\put(16,9){\ellipse{12}{18}}
\put(29.5,10){\ellipse{15}{20}}
\put(46,11){\ellipse{18}{22}}
\put(65,12.5){\ellipse{20}{25}}
\put(65,12.5){\vector(0,1){12.5}}
\put(65,12.5){\vector(0,-1){12.5}}
\put(65,25){\makebox(0,0)[b]{toe height}}
\put(65,12.5){\vector(1,0){10}}
\put(65,12.5){\vector(-1,0){10}}
\put(77,12.5){\makebox(0,0)[bl]{toe width}}
\qbezier(-5,0)(-5,24)(37.5,24)
\qbezier(37.5,24)(80,24)(80,0)
\put(-7,12){\vector(0,1){12}}
\put(-7,12){\vector(0,-1){12}}
\put(-10,12){\makebox(0,0)[r]{shoe extent}}
\put(37.5,-2){\vector(1,0){42.5}}
\put(37.5,-2){\vector(-1,0){42.5}}
\put(37.5,-4){\makebox(0,0){shoe width}}
\end{picture}
%\end{minipage}
\caption{A generalized foot and shoe, with toe 5 marked for chopping}
\label{fig:foot}
\end{figure}
The input will be six pairs of real numbers. The first five
pairs give the length and width of the five toes. The last
pair will give the extent and width of the shoe's toe. See
figure~\ref{fig:foot} for the generalized foot layout.
The output should state which toes, if any, must be removed.
Height and width of toe #1: 15 \,10
Height and width of toe #2: 18 \,12
Height and width of toe #3: 20 \,15
Height and width of toe #4: 22 \,18
Height and width of toe #5: 25 \,20
Extent and width of the shoe's toe: 24 \,85
This sister loses toe 5.
Height and width of toe #1: 3 \,1
Height and width of toe #2: 4 \,1.5
Height and width of toe #3: 4 \,2.1
Height and width of toe #4: 5 \,2.3
Height and width of toe #5: 6.2 \,3
Extent and width of the shoe's toe: 7 \,7
This sister loses toes 1, 2, and 5.
Height and width of toe #1: 2 \,1
Height and width of toe #2: 3 \,1
Height and width of toe #3: 4 \,1
Height and width of toe #4: 5 \,1
Height and width of toe #5: 4 \,1
Extent and width of the shoe's toe: 6 \,4
This sister loses toes 1 and 5.
Height and width of toe #1: 2 \,1.5
Height and width of toe #2: 3.1 \,1.8
Height and width of toe #3: 3.4 \,2.2
Height and width of toe #4: 4 \,2.2
Height and width of toe #5: 4.5 \,3
Extent and width of the shoe's toe: 4 \,9
This sister loses toes 1, 2, 4, and 5.
Height and width of toe #1: 2 \,1
Height and width of toe #2: 2.3 \,1.1
Height and width of toe #3: 2.3 \,1.2
Height and width of toe #4: 2.5 \,1.7
Height and width of toe #5: 2.7 \,2
Extent and width of the shoe's toe: 4 \,8
This sister loses no toes. So much for Cinderella.