1. THE PANTOGRAPH – JSP
The JSP Code

The JSP applet code given below was used to produce the diagram at right.

A word about errors. I tend to write two or three lines of code, and then check to see the result. This is a much easier way of detecting errors that leaving it until the end to check.

There are websites whch deal with compilation and runtime Java errors – for example:

http://stwww.weizmann.ac.il/G-CS/BENARI/java/errors.pdf

However, like me you might find that the cure is worse than the problem! Another thought for when you come across an error that seems inexplicable and unresolvable, there is usually more than one way of writing a code to produce the desired reult.

<APPLET CODE="GSP.class"
WIDTH=300 HEIGHT=300 ALIGN=left>
<PARAM NAME=Frame VALUE=1>
<PARAM NAME=BackRed VALUE=255>
<PARAM NAME=BackGreen VALUE=200>
<PARAM NAME=BackBlue VALUE=200>
<PARAM NAME=Construction VALUE="

{Define some segments to give fixed lengths}
{1} FixedPoint (0, 0) [hidden];
{2} FixedPoint (50, 0) [hidden];
{3} FixedPoint (100, 0) [hidden];

{And segments connecting them}
{4} Segment (1, 2) [hidden]; {length 50}
{5} Segment (1, 3) [hidden]; {length 100}

{Origin}
{6} FixedPoint (60, 150) [blue, label('O')];

{Free point Q}
{7} Point (110, 150) [label('Q')];

{Point N}
{8} Circle by radius (6, 4) [hidden];
{9} Circle by radius (7, 4) [hidden];
{10} Intersect1 (8, 9) [label('N')];
{11} Segment (7, 10) [thick, red];

{Point L}
{12} Line (6, 10) [hidden];
{13} Circle by radius (6, 5) [hidden];
{14} Intersect1 (12, 13) [label('L')];
{15} Segment (6, 14) [red, thick];

{Point M}
{16} Circle by radius (14, 4) [hidden];
{17} Intersect2 (9, 16) [label('M')];
{18} Segment (7, 17) [thick, red];

{Point P}
{19} Line (14, 17) [hidden];
{20} Line (6, 7) [hidden];
{21} Intersect (19, 20) [label('P')];
{22} Segment (14, 21) [thick, red];

{Trace paths}
{23} Translation (7, 1, 0) [hidden, traced];
{24} Translation (21, 1, 0) [hidden, traced];

{Buttons}
{25} ShowButton (50, 275, 'Trace on') (23, 24);
{26} HideButton (150, 275, 'Trace off') (23, 24);

">
</APPLET>



We have chosen a light red background for this applet.




We will be using lengths 50 and 100.




These segments will act to define circle radii.



Fix the origin; label it a special colour as the only fixed point.

The point Q is given a starting position, but will be the driving point for moving the pantograph.


Point N will be distant 50 from O and Q.
The manual is silent on the exact placing of Intersect1 and Intersect2. My guess is that Intersect1 might be closest to the top left corner? In any case, try one and see if it gives the expected point.

Point L lis on ON and is distant 100 from point O.




Point M is distant 50 from Q and L.




Point P lies on lines LM and OQ.
The purist might argue that it is preferable just to use measurements determined directly by the pantograph.



This is a gimmick! We want the option for points P, Q to show trace paths when moved, or not. If we include ‘traced’ in the square brackets describing P, Q, the HideButton eliminates the point as well as the trace. So we construct two new hidden points one pixel to the right of P, Q, and use these to trace the paths. Note the little red cross in the bottom right corner of the final figure when a path is traced: clicking the cross deletes the path. The question mark links to a page of JSP options.

Exercises

1. Sketch a diagram of a pantograph which would allow an enlargement of 1.5. Can you adapt the above program to achieve this? Could you sketch a diagram of a pantograph to achieve any given enlargement?

2. There is a simple way (in theory) to use our pantograph to draw a figure half the size of the original. What is it? Can you modify the above program to achieve this? (You will want to swap the roles of P and Q.)

3. Could we use our pantograph to achieve a ‘reflection in the origin’ (a rotation of 180° about the origin)? How? Can you modify our program to achieve this?

4. Our JSP diagram degenerates for one particular allowable position of P. Check this out. Why does it happen? Perhaps if we did our construction differently this might not happen? Explore this possibility.