Sketchpad: the GSP-JSP compatibility guide

Note: This page was written while the author was actively using the "3" versions of GSP and JSP for teaching and some research in Germany and Finland. The GSP/JSP author, Nick Jackiw, has kindly informed me that some of the issues have been resolved with GSP/JSP version 4. This page may at some point be updated, but currently still describes GSP DR 3.3.

If you use both The Geometer's Sketchpad (GSP) and the JavaSketchpad applet (JSP), you will often get annoyed by incompatibilities. Isn't it a humbling experience to subject yourself to the verdict of the GSP>HTML converter, just to be told that the angle bisector you based 80% of your GSP sketch on does not exist in the JSP construction language? Do you want to know what the pluses and minuses of using JSP versus GSP are (or the other way round)? Then you've come to the right place. I hope to extend this page in time and welcome any suggestions.

So, this is a comparison between GSP (as experienced by the author, mostly on Windows 95 systems) and JSP (mostly seen on Netscape under Win 95) in terms of missing/extra features, functionality, etc. Whereever one of the two programs is missing a feature, I hope that this page will provide some good advice to restore it. The list is not yet complete, so use it at your own risk.

Make your GSP sketches JSP-compatible

GSP script icon The most practical feature of this page, I hope, will be the GSP scripts I supply to replace functions that do not convert. For example, if you construct an angle bisector in GSP and then load the sketch into the GSP>HTML converter, it will tell you it hasn't converted the bisector (because there is no such construction in JSP's language). More drastically, everything that has been constructed using the angle bisector will not appear in the converted construction either. If only you had read this page before ... Unfortunately you can't change the dependencies of those elements that use your angle bisector. You will have to redo the construction, but how? You can use the GSP scripts from this page, they are marked by a "GSP script" icon like the one at the top of this paragraph. There is a script for angle bisectors, for example (several in fact), which will give you an angle bisector that can be converted. You only have to remember not to use the construction from the menu in the future and run the script instead. The easiest way to use the scripts is to define a script tool directory and put my scripts there, or possibly into a subdirectory that collects all these "compatibility" scripts. Mine is named "GspJsp".

JSP hackers need not be jealous

jsp.awk macro icon Like myself, you might be interested in writing JSP constructions "by hand". You don't have to feel left out by this webpage, it includes constructions equivalent to those made by the "compatibility scripts". The icon above will lead you to macros which you can use in my enhanced version of the JSP language, jsp.awk. (If you don't know jsp.awk but want to write JSP by hand, that link is definitely worth a look.)

If a row shows an entry just in one of the two categories (i.e. just for the application or just for the applet), the other category offers "full" or "normal" functionality.

JSP applet
GSP application
C o n s t r u c t i o n s
Points on Objects
Can only appear on straight objects or circles (not on loci or polygon interiors, and not on arcs as these can't be constructed at all).
No scripts, but there is one piece of advice for points on loci: Construct a point on the path with which the locus is defined and repeat the construction that created the driven point out of the driver point.
Not supported. Semi-compatible replacements using the Locus construction are possible. Construct your arcs with these scripts, not the item in the Construction menu. Still evolving; the "long" versions currently use a construction developed for Rotation/MeasuredAngle, see below. You must set the angle unit to radians in the GSP>HTML converter for the "long" versions to work. (Can they be done without calculations?)

jsp.awk macro to appear "Short" Arc
GSP script
jsp.awk macro to appear "Long" Arc (single)
GSP script
jsp.awk macro to appear "Long" Arc (double)
GSP script

Arc interiors
Not supported, no replacement seems possible.
Angle Bisectors
Not supported, but here is a fully compatible replacement. There is also an "almost compatible", more efficient variant (see the script comments for details) and another kind of angle bisector you might find interesting (with the same "efficient" variant).

jsp.awk macro Angle Bisector
GSP script
See also:
jsp.awk macro "Efficient" Angle Bisector
GSP script
jsp.awk macro Oriented Angle Bisector
GSP script
jsp.awk macro "Efficient" Oriented A. Bisector
GSP script

One variation is not supported. For convertable GSP sketches, you must take care not to use this variation.

Don't rotate by a measured angle
The unsupported kind of rotation would best be called "Rotation/MeasuredAngle", where the angle is given by a measurement, possibly a calculation. One problem when constructing a workaround is the different orientation of some angles between GSP and JSP, notably the angles used in certain Translation variants (see below). Therefore, the fully compatible replacement below is a tricky and longish construction. (The jsp.awk macro does not need to care about GSP and is therefore simpler.)

jsp.awk macro Rotate/MeasuredAngle
GSP script
See also:
small construction, correct in GSP, mirrored in JSP
GSP script
small construction, correct in JSP, mirrored in GSP
GSP script

Not all variations are supported. For convertable GSP sketches, you must take care not to use the unsupported variations.

Don't do a polar translation by marking a 3-point angle via "Transform | Mark Angle"
Two translation variants are not supported in JSP. They would be called "Translation/3PtAngle/{ Fixed, Marked }Distance" (or "MarkedAngle" if the existing "MarkedAngle" versions would use the more appropriate name "MeasuredAngle"). It is impossible to provide a script for the "FixedDistance" version as you can't have a running script ask the user for a fixed distance! You will have to perform this operation yourself. One general way is to measure the angle instead of marking it, and then translating. If it's a point that you want to translate, translate it by the fixed distance and a fixed angle of zero, and then rotate the result by the marked angle. For the "MarkedDistance" result, here is a script which runs on any object without measuring the angle. (In jsp.awk, macros for both fixed and measured distances are possible.)

jsp.awk macro Translation/3PtAngle/FixedDistance
no GSP script possible
jsp.awk macro Translation/3PtAngle/MarkedDistance
GSP script

Angle measurements are o.k. for polar translations, but are disoriented
A suprising problem is the negative angle orientation that is used for the other polar translations, Translation/FixedAngle/MarkedDistance, Translation/MarkedAngle/FixedDistance and Translation/MarkedAngle/MarkedDistance. (The latter two should better be called "MeasuredAngle", not "MarkedAngle", as mentioned before.) Everytime you use the respective GSP constructions, your converted object in JSP will be translated the other way! The problem is probably due to the downward orientation of the y axis in JSP. It seems hard to find a workaround that works both in JSP and GSP and doesn't rely the angle unit to be set to either radians or degrees. But one has been found for Rotation/MeasuredAngle and can also be used for these translations. Unfortunately, it is impossible to replace the two constructions that take a fixed angle or distance, as a script can't prompt for fixed values. Find one script and a collection of two macros below.

jsp.awk macro Translate/MarkedAngle/MarkedDistance
GSP script

Fixed angles and distances? No sir, but should we care?
A construction "Translation/FixedAngle/FixedDistance" is also absent from the JSP language. One could expect "PolarTranslation" to be just that, but the construction is only a synonym for "Translation". The GSP>HTLM converter calculates the correct x- and y-offsets while converting fixed polar GSP translations, so there is no real need to fix this. A jsp.awk macro could easily be done (but keep the downward orientation of the y axis in mind). You could just as well convert a fixed angle and distance to the respective offsets with any calculator and then use Translation.

To still call this construction "PolarTranslation" is a weird idea. Of course it is a bit of a service to tell readers of converted code that a translation was a polar one before the converter turned it into a cartesian one. But that could be done by inserting a comment on the same line too. Currently the "Polar" prefix is just a comment, basically. The JSP language definitely could do with some cleaning up (see e.g. the meaning of "Marked" in "Dilation/MarkedRatio" compared with "Rotation/MarkedAngle"), and "PolarTranslation" is an obvious case in point.

Cartesian translations: don't mix fixed and measured offsets
If you translate by a rectangular vector, you must not enter one offset as a fixed number and get the other offset from a measurement. Again, I can't supply a GSP script because you can't have a script prompt for a fixed number. You must construct a workaround by hand. An obvious solution, creating a constant calculation for the fixed value, fails if you're not careful (see "Calculations" below). I suggest using first a polar translation with a zero angle and the measurement, then possibly -- if the measurement is for the y distance -- a rotation by 90 degrees*, and then a cartesian translation, with the fixed value for one offset and zero for the other. (* For a measured y distance, you can't just use a polar translation with a 90 degrees angle -- see the "disoriented" section above).

Ironically, you can't convert a GSP calculation that is a constant, i.e. a single constant number or a term using just constant numbers. You must include some measured dummy value in the term (and multiply it by zero, or add and then subtract it, or something) to have the number appear in a JSP construction. This is related to the JSP requirement that the parameter list for the Calculate construction must not be empty.
Not available and not really required. If you want the construction, download this script and read its comments.

Unit Point
GSP script

A c t i o n   B u t t o n s
Sequence buttons
Not supported. Java programmers can create a replacement using the inter-applet communication mechanism. Watch this space ...
Automatic buttons
Several buttons can be automatic, 5 in the current release.
One button per sketch can be automatic. (You must save your sketch with just the one button selected.)
C a p t i o n s   a n d   F o r m a t s
No captions (text objects) can be created. Explanatory text must be supplied in the HTML code surrounding the applet.
Any RGB value can be given to any objects. Overlapping areal objects (polygons, circles) are opaque. Objects that appear later in the construction are "bottom" (!). The GSP>HTML converter does not handle the four saturations of areal GSP objects. Colours may need to be changed by hand in the converted code.
Limited palette: black, red, magenta, blue, cyan, green, yellow. Can be applied in four saturations to areal objects, in just one (full) saturation to all others. All areal objects are somewhat transparent.
Line styles
The "dashed" line style is not available. As an alternative, you can give a colour to your lines that is close to the background colour. This creates an optical illusion of thinness. (If you use the GSP>HTML converter, you must set the colour by editing the converted code.)
Can be set separately for all labels, all buttons and all measurements, but not to single instances of these.
Measurement formats
Mathematical format is not available, converted measurements will show the text known in Sketchpad as the "Text Format".

All numbers are displayed with a precision that can not be changed and which is guessed (not too badly) by the applet, but unfortunately restricted to 1-3 decimal digits. Thus there is no way of displaying integers as integers, even with the trunc/@trnc or round/@rond functions. Trailing zeros are removed.
(Scientific notation, which is used from 10^7 to 9223372036854775 and on the same negative range, is shown with up to 15 decimal digits. Numbers from 1e-323 to before +/-0.0005 are displayed as 0.0, from there to before +/-0.01 with 4 decimal digits.)

Units are not displayed by default; you have to include any units as text behind the number in GSP (which will make it look like two units) before converting. Lenghts and areas are measured in pixels and square pixels. You must use calculations if you want to scale to any other unit.

E m b e d d e d   O b j e c t s
Images in GIF format, must be given via an absolute URL. Both the applet and the picture must come from an HTTP server.
System dependent and not portable between the Mac and Windows platforms.

25. November 1999, Sebastian Lisken