-
Notifications
You must be signed in to change notification settings - Fork 0
/
graphics.ht
1305 lines (1230 loc) · 54.9 KB
/
graphics.ht
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% Copyright The Numerical Algorithms Group Limited 1991.
% Certain derivative-work portions Copyright (C) 1988 by Leslie Lamport.
% All rights reserved
% Graphics Page
% @(#)graphics.ht 1.9 91/05/29 15:31:14
%%%%%%%%%%%
%% Pages %%
%%%%%%%%%%%
\begin{page}{GraphicsPage}{Graphics}
\Language{} can plot curves and surfaces of
various types, as well as lists of points in the plane.
\beginscroll
There are two graphics frameworks which you can choose depending on
what type of output you want:
\beginmenu
\menulink{Old Framework}{GraphicsOld} \newline
This framework creates a graphics X window (on platforms that support
this). It can export images to Postscript and XPM bitmap file
formats.
\menulink{New Framework}{GraphicsNew} \newline
Scenegraph based graphics framework, this has a much more regular
structure which has more independence from the number of dimensions
used and the algebra used to represent the geometry.
\newline
There is no capability to create a graphics window, however the
graphics are exported to modern formats (such as SVG and X3D) which
allow the output to be modified and enhanced by specialist graphics
programs such as Inkscape and Blender.
\endmenu
\endscroll
\autobuttons \end{page}
\begin{page}{GraphicsOld}{Old Graphics Framework}
\Language{} can plot curves and surfaces of
various types, as well as lists of points in the plane.
\beginscroll
\beginmenu
\menulink{Examples}{GraphicsExamplePage} \tab{13}
See examples of \Language{} graphics
\menulink{2D Graphics}{TwoDimensionalGraphicsPage} \tab{13}
Graphics in the real and complex plane
\menulink{3D Graphics}{ThreeDimensionalGraphicsPage} \tab{13}
Plot surfaces, curves, or tubes around curves
\menulink{Viewports}{ViewportPage} \tab{13}
Customize graphics using Viewports
\endmenu
\endscroll
\autobuttons \end{page}
\begin{page}{GraphicsNew}{New Graphics Framework}
\beginscroll
The Scenegraph Concept
\newline
\beginmenu
\menulink{Scenegraph Overveiw}{ScengraphOverveiwPage}
Explanation of scenegraph concept
\menulink{Additional Constructs}{GridPage}
Various things can be added to the graphics such as grids and rulers.
\menulink{1 dimension in 2 dimensions}{OneDInTwoDPage}
One Dimensional subspace in Two Dimensions such as a line in a plane.
\menulink{1 dimension in 3 dimensions}{OneDInThreeDPage}
One Dimensional subspace in Three Dimensions such as a line in a 3D space.
\menulink{2 dimensions in 3 dimensions}{TwoDInThreeDPage}
Two Dimensional subspace in Three Dimensions such as a surface in a 3D space.
\menulink{Exporting the graphics}{ExportingPage}
Exporting to SVG, X3D and Obj formats.
\menulink{Example 1}{Example1Page}
Example of how to use the code
\endmenu
\endscroll
\autobuttons \end{page}
\begin{page}{ScengraphOverveiwPage}{Scenegraph Concept}
\beginscroll
The Scenegraph Concept
\newline
A scenegraph consists of a number of nodes in a tree structure, the types of
nodes are:
\beginmenu
\menulink{Scenegraph}{ScenegraphPage}
Mode information about scenegraph concept
\menulink{Root Node}{RootNodePage}
Root Node
\menulink{Group Node}{GroupNodePage}
Group Node
\menulink{Line Node}{LineNodePage}
Line Node
\menulink{IFS Node}{IFSNodePage}
Indexed Face Set (IFS) Node
\menulink{Text Node}{TextNodePage}
Text Node
\menulink{Clip Node}{ClipNodePage}
Clip Node
\menulink{Material Node}{MaterialNodePage}
Material Node
\menulink{Transform Node}{TransformNodePage}
Transform Node
%\menulink{ArrowNode}{ArrowNode}
%Arrow Node
\endmenu
\endscroll
\autobuttons \end{page}
\begin{page}{ScenegraphPage}{Scenegraph}
\beginscroll
This tree is constructed by starting with the root node and adding child
nodes using the addChild! function as follows:
\begin{verbatim}
addChild!:(n:%,c:%) -> Void
\end{verbatim}
where 'c' is the child node and 'n' node that it is being added to. Any
node type can be a child node or a parent (although it only makes sense
to put the root node only at the root).
\newline
In general a given node will affect only those nodes under it in the tree
structure.
\newline
The purpose and constructors of these nodes is as follows:
(in the following definitions PT refers to an instance of SPointCategory
such as SCartesian(2),SCartesian(3),SArgand and SConformal).
\endscroll
\autobuttons \end{page}
\begin{page}{RootNodePage}{Root Node}
\beginscroll
Root Node
\newline
Constructs the root node, all other nodes are contained in a tree structure
under this node. The root node can have a bounding box which indicates the
extent where the graphical objects exist. This allows the export code, for
example, to have an area to draw the graphics in.
\begin{verbatim}
createSceneRoot:() -> %
createSceneRoot:(bb: SBoundary(PT)) -> %
createSceneRoot:(minx:I,miny:I,maxx:I,maxy:I) -> %
\end{verbatim}
The parameters define the boundary. This bounding box is intended to
be the area or volume in which the graphical objects are drawn,
elements of the geometry outside this area will not necessarily
be clipped (to be sure use a clipping node with the same boundary).
The bounding box in the root node has these additional effects:
\newline
When exported to a drawing or editing application this defines
the default area available for display of the graphics on the screen.
\newline
It allows some elements such as line widths, font sizes, width of
arrow heads and so on to be scaled so that they are of an
appropriate size for the overall screen area. In mathematical
terms a line has no width but when drawing it we need to give
it a nominal width so that it can be seen.
\newline
If the first version (without boundary information) is used then
the boundary will be calculated, to include all the nodes, when
the scene is first drawn to a file.
\endscroll
\autobuttons \end{page}
\begin{page}{GroupNodePage}{Group Node}
\beginscroll
Group Node
\newline
Constructs a group node, this node does not do anything itself
but contains other nodes. Any node can contain other nodes - we
do not need to use a group node to do this, but if we just want
to group nodes without any other effects then this is a good
choice.
\begin{verbatim}
createSceneGroup:() -> %
addSceneGroup:(n:%) -> %
\end{verbatim}
addSceneGroup is a convenience function which combines the constructor
createSceneGroup with addChild! This allows a scene graph node to be
constructed and added to the scenegraph in one operation.
Most of the scenegraph constructors have this form as an option.
\endscroll
\autobuttons \end{page}
\begin{page}{LineNodePage}{Line Node}
\beginscroll
Line Node
\newline
Constructs a line node, this contains a (possibly curved) line,represented
by a list of points) in n-dimensional space. The dimension of the space is
implicit in the type of points being used.
A Line node can hold a single line or multiple lines. The reason that a
Line node needs to hold multiple lines is that, when a clip is applied
to a line this might break it into several line segments.
\begin{verbatim}
createSceneLine:(line: List PT) -> %
addSceneLine:(n:%,line: List PT) -> %
createSceneLines:(line: LINES) -> %
addSceneLines:(n:%,line: LINES) -> %
\end{verbatim}
Where: LINES==> List List PT
\endscroll
\autobuttons \end{page}
\begin{page}{IFSNodePage}{IFS Node}
\beginscroll
Indexed Face Set (IFS) Node
\newline
Constructs an indexed face set node, this defines a surface in n-dimensional
space represented by a set of polygons in n-dimensional space.
\begin{verbatim}
createSceneIFS:(inx: List List NNI,pts: List PT) -> %
addSceneIFS:(n:%,inx: List List NNI,pts: List PT) -> %
createSceneIFS:(in1: SceneIFS(PT)) -> %
addSceneIFS:(n:%,in1: SceneIFS(PT)) -> %
\end{verbatim}
A specialised constructor for an IFS node constructs a 3D box.
Constructs an indexed face set node which is a 3D box of a given size
\begin{verbatim}
createSceneBox:(size:DF) -> %
addSceneBox:(n:%,size:DF) -> %
\end{verbatim}
\endscroll
\autobuttons \end{page}
\begin{page}{TextNodePage}{Text Node}
\beginscroll
Text Node
\newline
Constructs a text node, text can be used for labelling anything
such as graphs, axes and so on.
\begin{verbatim}
createSceneText:(text: TEXT) -> %
addSceneText:(n:%,text: TEXT) -> %
createSceneText:(str:String,sz:NNI,pz:PT) -> %
addSceneText:(n:%,str:String,sz:NNI,pz:PT) -> %
\end{verbatim}
where: TEXT==> Record(txt:String,siz:NNI,pos:PT)
which defines the text to be printed with its size and position.
\endscroll
\autobuttons \end{page}
\begin{page}{ClipNodePage}{Clip Node}
\beginscroll
Clip Node
\newline
Constructs a clip node, clips its sub nodes in the coordinate
system in force at the clip node.
\begin{verbatim}
createSceneClip:(bb: SBoundary(PT)) -> %
addSceneClip:(n:%,bb: SBoundary(PT)) -> %
\end{verbatim}
where: bb is the boundary that the node is clipped to.
\endscroll
\autobuttons \end{page}
\begin{page}{MaterialNodePage}{Material Node}
\beginscroll
Material Node
\newline
Constructs a material node
This sets the lineWidth,lineCol and fillCol for all nodes under
this, unless overridden by another material node.
That is the material parameters that apply to a given node are
those of the closest material node above it in the hierarchy
\begin{verbatim}
createSceneMaterial:(mat:MATERIAL) -> %
addSceneMaterial:(n:%,mat:MATERIAL) -> %
createSceneMaterial:(lineW:DF,lineC:String,fillC:String) -> %
addSceneMaterial:(n:%,lineW:DF,lineC:String,fillC:String) -> %
\end{verbatim}
Where: MATERIAL==> Record(lineWidth:DF,lineCol:String,fillCol:String)
\endscroll
\autobuttons \end{page}
\begin{page}{TransformNodePage}{Transform Node}
\beginscroll
Transform Node
\newline
Constructs a transform node
This transforms the points and vectors below this node
If a given node has more than one transform node above
it in the hierarchy then the transforms are concatenated (combined).
\begin{verbatim}
createSceneTransform:(tran:TR) -> %
addSceneTransform:(n:%,tran:TR) -> %
\end{verbatim}
\endscroll
\autobuttons \end{page}
\begin{page}{GridPage}{Grid}
\beginscroll
Drawing Plots and grids
\newline
The following constructors create 'compound' nodes in that the node
returned has subnodes under it.
\newline
Grids and Patterns
\newline
Grids are useful as a background to plots, they consist of various
straight, horizontal and vertical lines.
\newline
The form without the step size constructs a grid with:
\newline
narrow blue lines every 20 units \newline
wide blue lines every 100 units \newline
wide red lines every 200 units \newline
The form with step uses the prevailing colour and thickness and the
step parameter defines the spacing between lines.
\newline
Since the lines in grids are defined by the endpoints of the lines, it
does not make sense to apply a non-linear transform to them as the
lines will remain straight and won't be transformed as they should.
\newline
Patterns are used to show the effect of transforms. Although they may
be approximated by straight lines the points are intended to be close
enough together to transform reasonably accurately.
\newline
The pattern depends on ptype parameter as follows:
\newline
"GRID"::Symbol: construct a set of horizontal and vertical lines in the current
clip boundary and current material with a spacing between
lines given by the step parameter.\newline
"SIERPINSKI"::Symbol: constructs a Sierpinski fractel. step parameter gives the
level of subdivision.\newline
"HOUSE"::Symbol: constructs a house shape.\newline
\begin{verbatim}
createScenePattern(ptype:Symbol,step:NNI,bb: SBoundary(PT)): %
addScenePattern(n:%,ptype:Symbol,step:NNI,bb: SBoundary(PT)):%
\end{verbatim}
\endscroll
\autobuttons \end{page}
\begin{page}{OneDInTwoDPage}{1 dimension in 2 dimensions}
\beginscroll
One Dimensional subspace in Two Dimensions
\newline
This represents 1 dimension (line - possibly curved) in 2 dimensions (plane)
The line is approximated as end-to-end straight lines defined by a list of
points. In theory a line has no width but in that case we would not see it
so we give it a width given by the material node that is
applicable in this part of the scene graph.
\newline
The plot is defined by a function and a range of values. There are various
ways to define this function:
\newline
DF -> DF a mapping from float to float\newline
DF -> PT a mapping from float to point\newline
\newline
Where:\newline
DF ==> DoubleFloat\newline
PT ==> SPointCategory -- an instance of SPointCategory represents a point.
We can also create the plot using an indirect parameter. (parametric)\newline
PPC is ParametricPlaneCurve(DF -> DF) which is created with curve(f1,f2)\newline
where f1 and f2 are functions of type ComponentFunction, in this case
DF -> DF
\begin{verbatim}
createPlot1Din2D: (f:DF -> PT,tRange:SEG,numPts:NNI) -> %
addPlot1Din2D: (n:%,f:DF -> PT,tRange:SEG,numPts:NNI) -> %
createPlot1Din2D: (DF -> DF,SEG,numPts:NNI) -> %
addPlot1Din2D: (n:%,DF -> DF,SEG,numPts:NNI) -> %
createPlot1Din2Dparametric: (PPC,SEG,numPts:NNI) -> %
addPlot1Din2Dparametric: (n:%,PPC,SEG,numPts:NNI) -> %
\end{verbatim}
\endscroll
\autobuttons \end{page}
\begin{page}{OneDInThreeDPage}{1 dimension in 3 dimensions}
\beginscroll
One Dimensional subspace in Three Dimensions
\newline
create a line (1D subspace) in 3D space
This represents 1 dimension (line - possibly curved) in 3 dimensions.
In theory a line has no width but in that case we would not see it
so we give it a width given by the material node that is
applicable in this part of the scene graph.
\newline
Again there are various ways to define this function:
PCFUN is a function from float to point: DF -> PT
PSC ParametricSpaceCurve(DF -> DF) is created with curve(f1,f2,f3)
where f1,f2 and f3 are functions of type ComponentFunction, in this case
DF -> DF
create a line (1D subspace) in 3D space
\begin{verbatim}
createPlot1Din3Dparametric: (PSC,SEG,numPts:NNI) -> %
addPlot1Din3Dparametric: (n:%,PSC,SEG,numPts:NNI) -> %
createPlot1Din3Dparametric: (PCFUN,SEG,numPts:NNI) -> %
addPlot1Din3Dparametric: (n:%,PCFUN,SEG,numPts:NNI) -> %
\end{verbatim}
\endscroll
\autobuttons \end{page}
\begin{page}{TwoDInThreeDPage}{2 dimension in 3 dimensions}
\beginscroll
Two Dimensional subspace in Three Dimensions (surface)
\newline
create a surface (2D subspace) in 3D space
The surface is approximated by polygons which are
represented by in indexed face set (IFS) node
create a surface (2D subspace) in 3D space
\begin{verbatim}
createPlot2Din3D: (ptFun:PSFUN,uSeg:SEG,vSeg:SEG,numPts:NNI) -> %
createPlot2Din3D: ((DF,DF) -> DF,SEG,SEG,numPts:NNI) -> %
addPlot2Din3D: (n:%,(DF,DF) -> DF,SEG,SEG,numPts:NNI) -> %
createPlot2Din3Dparametric: (PSFUN, SEG, SEG,numPts:NNI) -> %
addPlot2Din3Dparametric: (n:%,PSFUN, SEG, SEG,numPts:NNI) -> %
createPlot2Din3Dparametric: (PSF,SEG,SEG,numPts:NNI) -> %
addPlot2Din3Dparametric: (n:%,PSF,SEG,SEG,numPts:NNI) -> %
\end{verbatim}
\endscroll
\autobuttons \end{page}
\begin{page}{ExportingPage}{Exporting}
\beginscroll
Exporting the graphics
\newline
This scenegraph framework currently exports to the following file formats:
\newline
SVG - For 2 dimensional graphics this is the most standards based and also
supported by graphical editors such as Inkscape.\newline
X3D - For 3 dimensional graphics I think this is the most standards
compliant but it is not supported on many 3D editors.\newline
VRML - VRML2 and VRML97 are supported but not VRML1. This flavour of
VRML holds the same information as X3D but using a different
non-XML syntax.\newline
Wavefront(obj) - This is a very simple 3D format that will hold meshes
but not text or colour information. It is supported on
most 3D editors but only use it as a fallback if the
other 3D formats don't work.\newline
To export a scenegraph to one of these file formats use the following
function calls:
\newline
Write an 'SVG' representation of node 'n' (usually the root node) to
the filename supplied:
\begin{verbatim}
writeSvg:(n:%,filename:String) -> Void
\end{verbatim}
Write an 'X3D' representation of node 'n' (usually the root node)
to the filename supplied.
\begin{verbatim}
writeX3d:(n:%,filename:String) -> Void
\end{verbatim}
Write a 'VRML' representation of node 'n' (usually the root node)
to the filename supplied.
\begin{verbatim}
writeVRML:(n:%,filename:String) -> Void
\end{verbatim}
Write an 'OBJ' (Wavefront) representation of node 'n' (usually the
root node) to the filename supplied.
\begin{verbatim}
writeObj:(n:%,filename:String) -> Void
\end{verbatim}
If we only want to create an XML structure without writing to a file
we can use these functions:
\newline
create an XmlElement containing a 'SVG' representation of node 'n' and
the nodes below it:
\begin{verbatim}
toSVG:(n:%,mat:MATERIAL,tran:TR,bb: SBoundary(PT)) -> XmlElement
\end{verbatim}
Create an XmlElement containing a 'X3D' representation of node 'n' and
the nodes below it:
\begin{verbatim}
toX3D:(n:%,mat:MATERIAL,tran:TR,bb: SBoundary(PT)) -> XmlElement
\end{verbatim}
Creates .OBJ (Wavefront) structures from scenegraph tree structure called
recursively for each node, so when called on root node in scenegraph
all other nodes in the scenegraph will get called. When called the
reference values should be empty or zero and when the function returns
they will be set.
\begin{verbatim}
toObj:(n:%,ptLst: Reference List PT,_
indexLst:Reference List List NNI,_
indexNxt:Reference NNI,tran:TR,bb: SBoundary(PT)) -> Void
\end{verbatim}
\endscroll
\autobuttons \end{page}
\begin{page}{Example1Page}{Example1}
\beginscroll
Using the code
\newline
Example 1 - Two dimensional plots with scale.
First we will create a couple of functions to plot:
\newline
\spadpaste{DF ==> DoubleFloat}
\spadpaste{fnsin(x:DF):DF == sin(x/100::DF)*400::DF}
\spadpaste{fntan(x:DF):DF == tan(x/100::DF)*400::DF}
\newline
Then we create a bounding box, this is the box within which we do the drawing.
This contains two points representing the maximum and minimum extent of the
drawing area or volume. That is mins contains the minimum values of x,y...
and maxs contains the maximum values of x,y...
\newline
\spadpaste{view := boxBoundary(sipnt(0,-500)$SCartesian(2),sipnt(1200,500)$SCartesian(2)) \bound{view} }
\spadpaste{sc := createSceneRoot(view)$Scene(SCartesian(2)) \bound{sc} \free{view}}
\spadpaste{gd := addSceneGrid(sc,view)$Scene(SCartesian(2)) \bound{gd} \free{sc view}}
\newline
we can now export this to a SVG file so that we can confirm that
the scene contains a grid
\newline
\spadpaste{writeSvg(sc,"test1.svg") \free{sc gd}}
\newline
Now lets add a plot to this. First we add a 'material' node to the root to
define the colour and thickness of the plot.
\newline
\spadpaste{mt1 := addSceneMaterial(sc,3::DF,"blue","green")$Scene(SCartesian(2)) \bound{mt1} \free{sc gd}}
\newline
Then we add the plot to the material node using the sine function that we
defined earlier.
\newline
\spadpaste{ln1 := addPlot1Din2D(mt1,fnsin,0..1000::DF,49)$Scene(SCartesian(2))
\bound{ln1} \free{mt1}}
\newline
we can now export this to a SVG file again to see that
the plot has been added to the grid
\newline
\spadpaste{writeSvg(sc,"test2.svg") \free{sc ln1}}
\newline
Lets now add second plot to the scene so that we can see how to modify
it using material, transform and clip.
\newline
\spadpaste{mt2 := addSceneMaterial(sc,3::DF,"green","green")$Scene(SCartesian(2))}
\spadpaste{tr2 := addSceneTransform(mt2,stransform([_
[1::DF,0::DF,0::DF],_
[0::DF,1::DF,0::DF],_
[0::DF,0::DF,1::DF]]))$Scene(SCartesian(2))}
\spadpaste{bb := boxBoundary(sipnt(100,-400)$SCartesian(2),sipnt(1100,400)$SCartesian(2))}
\spadpaste{bb2 := addSceneClip(tr2,bb)$Scene(SCartesian(2))}
\spadpaste{ln2 := addPlot1Din2D(bb2,fntan,0..1000::DF,49)$Scene(SCartesian(2))}
\spadpaste{tx := addSceneText(sc,"sin(theta)",32::NNI,_
sipnt(200,400)$SCartesian(2))$Scene(SCartesian(2))}
\spadpaste{writeSvg(sc,"test3.svg")}
\endscroll
\autobuttons \end{page}
% Graphics Example Page
\begin{page}{GraphicsExamplePage}{Examples}
\beginscroll
Here are some examples of \Language{} graphics.
Choose a specific type of graph or choose Assorted Examples.
\beginmenu
\menulink{Assorted Examples}{AssortedGraphicsExamplePage} \newline
Examples of each type of \Language{} graphics.
\menulink{Three Dimensional Graphics}{ThreeDimensionalGraphicsExamplePage} \newline
Plot parametrically defined surfaces of three functions.
\menulink{Functions of One Variable}{OneVariableGraphicsExamplePage} \newline
Plot curves defined by an equation y = f(x).
\menulink{Parametric Curves}{ParametricCurveGraphicsExamplePage} \newline
Plot curves defined by parametric equations x = f(t), y = g(t).
\menulink{Polar Coordinates}{PolarGraphicsExamplePage} \newline
Plot curves given in polar form by an equation r = f(theta).
\menulink{Implicit Curves}{ImplicitCurveGraphicsExamplePage} \newline
Plot non-singular curves defined by a polynomial equation
\menulink{Lists of Points}{ListPointsGraphicsExamplePage} \newline
Plot lists of points in the (x,y)-plane.
% \menulink{Sequences}{SequenceGraphicsExamplePage}
% Plot a sequence a1, a2, a3,...
% \menulink{Complex Functions}{ComplexFunctionGraphicsExamplePage}
% Plot complex functions of a complex variable by means of grid plots.
\endmenu
\endscroll
\autobuttons \end{page}
% Assorted Graphics Example Page
\begin{page}{AssortedGraphicsExamplePage}{Assorted Examples}
\beginscroll
Pick a specific example or choose 'All' to see all the examples.\newline
Function of two variables: z = f(x,y).
\graphpaste{draw(sin(x * y), x = -2.5..2.5, y = -2.5..2.5) \bound{example1}}
Function of one variable: y = f(x).
\graphpaste{draw(sin tan x - tan sin x,x = 0..6) \bound{example2} }
Plane parametric curve: x = f(t), y = g(t).
\graphpaste{draw(curve(sin(t)*sin(2*t), sin(3*t)*sin(4*t)), t = 0..2*\%pi) \bound{example3}}
Space parametric curve: x = f(t), y = g(t), z = h(t).
\graphpaste{draw(curve(sin(t)*sin(2*t), sin(3*t)*sin(4*t), sin(5*t)*sin(6*t)), t = 0..2*\%pi) \bound{example4}}
Polar coordinates: r = f(theta).
\graphpaste{draw(sin(17*t), t = 0..2*\%pi, coordinates == polar) \bound{example5}}
Implicit curves: p(x,y) = 0.
\graphpaste{draw(y^2 + y = x^3 - x, x, y,range == \[-2..2,-2..1\]) \bound{example6}}
Run all examples.
\spadpaste{All \free{example1 example2 example3 example4 example5 example6}}
\endscroll
\autobuttons \end{page}
% Three Dimensional Graphics Example Page
\begin{page}{ThreeDimensionalGraphicsExamplePage}{Three Dimensional Graphics}
Plots of parametric surfaces defined by functions f(u,v), g(u,v), and h(u,v).
Choose a particular example or choose 'All' to see all the examples.
\beginscroll
Pear Surface.
\graphpaste{draw(surface((1+exp(-100*u*u))*sin(\%pi*u)*sin(\%pi*v), (1+exp(-100*u*u))*sin(\%pi*u)*cos(\%pi*v), (1+exp(-100*u*u))*cos(\%pi*u)), u=0..1, v=0..2, title=="Pear") \bound{example1}}
Trigonometric Screw.
\graphpaste{draw(surface(x*cos(y),x*sin(y),y*cos(x)), x=-4..4, y=0..2*\%pi, var1Steps==40, var2Steps==40, title=="Trig Screw") \bound{example2}}
Etruscan Venus. \newline
(click on the draw button to execute this example)
\spadpaste{a := 1.3 * cos(2*x) * cos(y) + sin(y) * cos(x)\bound{a}}
\newline
\spadpaste{b := 1.3 * sin(2*x) * cos(y) - sin(y) * sin(x)\bound{b}}
\newline
\spadpaste{c := 2.5 * cos(y) \bound{c}}
\newline
\graphpaste{draw(surface(a,b,c), x=0..\%pi, y=-\%pi..\%pi, var1Steps==40, var2Steps==40, title=="Etruscan Venus") \free{a b c} \bound{example3}}
Banchoff Klein Bottle. \newline
(click on the draw button to execute this example)
\spadpaste{f:=cos(x)*(cos(x/2)*(sqrt(2) + cos(y))+(sin(x/2)*sin(y)*cos(y)))\bound{f}}
\newline
\spadpaste{g:=sin(x)*(cos(x/2)*(sqrt(2) + cos(y))+(sin(x/2)*sin(y)*cos(y)))\bound{g}}
\newline
\spadpaste{h:=-sin(x/2)*(sqrt(2)+cos(y)) + cos(x/2)*sin(y)*cos(y) \bound{h}}
\newline
\graphpaste{draw(surface(f,g,h), x=0..4*\%pi, y=0..2*\%pi, var1Steps==50, var2Steps==50, title=="Banchoff Klein Bottle") \free{f g h} \bound{example4}}
\newline
\spadpaste{All \free{example1 example2 example3 example4}}
\endscroll
\autobuttons \end{page}
% Functions of One Variable Example Page
\begin{page}{OneVariableGraphicsExamplePage}{Functions of One Variable}
\beginscroll
Plots of functions y = f(x).
Choose a particular example or choose 'All' to see all the examples.
\graphpaste{draw(sin tan x - tan sin x, x = 0..6) \bound{example1}}
\newline
\graphpaste{draw(sin x + cos x, x = 0..2*\%pi) \bound{example2}}
\newline
\graphpaste{draw(sin(1/x), x = -1..1) \bound{example3}}
\newline
\graphpaste{draw(x * sin(1/x), x = -1..1) \bound{example4}}
\newline
\spadpaste{All \free{example1 example2 example3 example4}}
\endscroll
\autobuttons \end{page}
% Parametric Curve Example Page
\begin{page}{ParametricCurveGraphicsExamplePage}{Parametric Curves}
Plots of parametric curves x = f(t), y = g(t).
Pick a particular example or choose 'All' to see all the examples.
\beginscroll
The Lemniscate of Bernoulli.
\graphpaste{draw(curve(cos(t/(1+sin(t)^2)), sin(t)*cos(t)/(1+sin(t)^2)), t = -\%pi..\%pi) \bound{example1}}
Lissajous curve.
\graphpaste{draw(curve(9*sin(3*t/4), 8*sin(t)), t = -4*\%pi..4*\%pi) \bound{example2}}
A gnarly closed curve.
\graphpaste{draw(curve(sin(t)*sin(2*t)*sin(3*t), sin(4*t)*sin(5*t)*sin(6*t)),t = 0..2*\%pi)
\bound{example3}}
Another closed curve.
\graphpaste{draw(curve(cos(4*t)*cos(7*t), cos(4*t)*sin(7*t)), t = 0..2*\%pi) \bound{example4}}
Run all examples on this page.
\spadpaste{All \free{example1 example2 example3 example4}}
\endscroll
\autobuttons \end{page}
% Polar Coordinates Example Page
\begin{page}{PolarGraphicsExamplePage}{Polar Coordinates}
Plots of curves given by an equation in polar coordinates, r = f(theta).
Pick a particular example or choose 'All' to see all the examples.
\beginscroll
A Circle.
\graphpaste{draw(1,t = 0..2*\%pi, coordinates == polar) \bound{example1} }
A Spiral.
\graphpaste{draw(t,t = 0..100, coordinates == polar) \bound{example2} }
A Petal Curve.
\graphpaste{draw(sin(4*t), t = 0..2*\%pi, coordinates == polar) \bound{example3} }
A Limacon.
\graphpaste{draw(2 + 3 * sin t, t = 0..2*\%pi, coordinates == polar) \bound{example4} }
Run all examples on this page.
\spadpaste{All \free{
%example1
example2 example3 example4}}
\endscroll
\autobuttons \end{page}
% Implicit Curve Example Page
\begin{page}{ImplicitCurveGraphicsExamplePage}{Implicit Curves}
Non-singular curves defined by a polynomial equation p(x,y) = 0
in a rectangular region in the plane.
Pick a particular example or choose 'All' to see all the examples.
\beginscroll
A Conic Section (Hyperbola).
\graphpaste{draw(x * y = 1, x, y, range == \[-3..3, -3..3\]) \bound{example1} }
An Elliptic Curve.
\graphpaste{draw(y^2 + y = x^3 - x, x, y, range == \[-2..2, -2..1\]) \bound{example2} }
Cartesian Ovals.
\spadpaste{p := ((x^2 + y^2 + 1) - 8*x)^2 - (8*(x^2 + y^2 + 1) - 4*x - 1) \bound{p} }
\graphpaste{draw(p = 0, x, y, range == \[-1..11, -7..7\], title == "Cartesian Ovals") \free{p} \bound{example3} }
Cassinian Ovals: two loops.
\spadpaste{q := (x^2 + y^2 + 7^2)^2 - (6^4 + 4*7^2*x^2) \bound{q} }
\graphpaste{draw(q = 0, x, y, range == \[-10..10, -4..4\], title == "Cassinian oval with two loops") \free{q} \bound{example4} }
Run all examples on this page.
\spadpaste{All \free{example1 example2 example3 example4}}
\endscroll
\autobuttons \end{page}
% Lists of Points Example Page
\menulink{Lists of Points}{ListPointsGraphicsExamplePage} \newline
\begin{page}{ListPointsGraphicsExamplePage}{Lists of Points}
\Language{} has the ability to create lists of points in a two dimensional
graphics viewport. This is done by utilizing the \spadtype{GraphImage} and
\spadtype{TwoDimensionalViewport} domain facilities.
\beginscroll
\indent{5}\newline
{\em NOTE: It is only necessary to click on the makeViewport2D command button to plot this curve example}.
\indent{0}\newline
\spadpaste{p1 := point [1::SF,1::SF]\$(Point SF) \bound{p1}}
\newline
\spadpaste{p2 := point [0::SF,1::SF]\$(Point SF) \bound{p2}}
\newline
\spadpaste{p3 := point [0::SF,0::SF]\$(Point SF) \bound{p3}}
\newline
\spadpaste{p4 := point [1::SF,0::SF]\$(Point SF) \bound{p4}}
\newline
\spadpaste{p5 := point [1::SF,.5::SF]\$(Point SF) \bound{p5}}
\newline
\spadpaste{p6 := point [.5::SF,0::SF]\$(Point SF) \bound{p6}}
\newline
\spadpaste{p7 := point [0::SF,0.5::SF]\$(Point SF) \bound{p7}}
\newline
\spadpaste{p8 := point [.5::SF,1::SF]\$(Point SF) \bound{p8}}
\newline
\spadpaste{p9 := point [.25::SF,.25::SF]\$(Point SF) \bound{p9}}
\newline
\spadpaste{p10 := point [.25::SF,.75::SF]\$(Point SF) \bound{p10}}
\newline
\spadpaste{p11 := point [.75::SF,.75::SF]\$(Point SF) \bound{p11}}
\newline
\spadpaste{p12 := point [.75::SF,.25::SF]\$(Point SF) \bound{p12}}
\newline
\spadpaste{llp := [[p1,p2],[p2,p3],[p3,p4],[p4,p1],[p5,p6],[p6,p7],[p7,p8],[p8,p5],[p9,p10],[p10,p11],[p11,p12],[p12,p9]] \bound{llp} \free{p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12}}
\newline
\spadpaste{size1 := 6::PositiveInteger \bound{size1}}
\newline
\spadpaste{size2 := 8::PositiveInteger \bound{size2}}
\newline
\spadpaste{size3 := 10::PositiveInteger \bound{size3}}
\newline
\spadpaste{lsize := [size1, size1, size1, size1, size2, size2, size2, size2, size3, size3, size3, size3] \bound{lsize} \free{size1 size2 size3}}
\newline
\spadpaste{pc1 := pastel red() \bound{pc1}}
\newline
\spadpaste{pc2 := dim green() \bound{pc2}}
\newline
\spadpaste{pc3 := pastel yellow() \bound{pc3}}
\newline
\spadpaste{lpc := [pc1, pc1, pc1, pc1, pc2, pc2, pc2, pc2, pc3, pc3, pc3, pc3] \bound{lpc} \free{pc1 pc2 pc3}}
\newline
\spadpaste{lc := [pastel blue(), light yellow(), dim green(), bright red(), light green(), dim yellow(), bright blue(), dark red(), pastel red(), light blue(), dim green(), light yellow()] \bound{lc}}
\newline
\spadpaste{g := makeGraphImage(llp,lpc,lc,lsize)\$GRIMAGE \bound{g} \free{llp lpc lc lsize}}
\newline
\graphpaste{makeViewport2D(g,[title("Lines")])\$VIEW2D \free{g}}
The \spadfun{makeViewport2D} command takes a list of options as a parameter
in this example. The string "Lines" is designated as the viewport's title.
\endscroll
\autobuttons \end{page}
% Three Dimensional Graphics Page
\begin{page}{ThreeDimensionalGraphicsPage}{Three Dimensional Graphing}
\beginscroll
\beginmenu
\menulink{Functions of Two Variables}{TwoVariableGraphicsPage} \newline
Plot surfaces defined by an equation z = f(x,y).
\menulink{Parametric Curves}{SpaceCurveGraphicsPage} \newline
Plot curves defined by equations x = f(t), y = g(t), z = g(t).
\menulink{Parametric Tube Plots}{ParametricTubeGraphicsPage} \newline
Plot a tube around a parametric space curve.
\menulink{Parametric Surfaces}{ParametricSurfaceGraphicsPage} \newline
Plot surfaces defined by x = f(u,v), y = g(u,v), z = h(u,v).
\menulink{Building Objects}{ugGraphThreeDBuildPage} \newline
Create objects constructed from geometric primitives.
\endmenu
\endscroll
\autobuttons \end{page}
% Functions of Two Variables Graphics Page
\begin{page}{TwoVariableGraphicsPage}{Functions of Two Variables}
\beginscroll
This page describes the plotting of surfaces defined by an equation
of two variables, z = f(x,y), for which the ranges of x and y are explicitly
defined. The basic draw command for this function utilizes either the
uncompiled function or compiled function format. The general format for an
uncompiled function is:
\indent{5}\newline
{\em draw(f(x,y), x = a..b, y = c..d)}
\indent{0}\newline
where a..b and c..d are segments defining the intervals [a,b] and [c,d] over
which the variables x and y span. In this case the function is not compiled
until the draw command is executed. Here is an example:
\graphpaste{draw(cos(x*y),x=-3..3,y=-3..3)}
In the case of a compiled function, the function is named and compiled
independently. This is useful if you intend to use a function often, or
if the function is long and complex. The following line shows a function
whose parameters are of the type Small Float. The function is compiled and
stored by \Language{} when it is entered.
\indent{5}\newline
{\em NOTE: It is only necessary to click on the draw command button to plot
this example}.
\indent{0}\newline
\spadpaste{f(x:SF,y:SF):SF == sin(x)*cos(y) \bound{f}}
\newline
Once the function is compiled the draw command only needs the name of the
function to execute. Here is a compiled function example:
\graphpaste{draw(f,-\%pi..\%pi,-\%pi..\%pi) \free{f}}
Note that the parameter ranges do not take the variable names as in the
case of uncompiled functions. The variables are entered in the order in
which they are defined in the function specification. In this case the
first range specifies the x-variable and the second range specifies the
y-variable.
\endscroll
\autobuttons \end{page}
% Parametric Space Curves Graphics Page
\begin{page}{SpaceCurveGraphicsPage}{Parametric Space Curves}
\beginscroll
This page describes the plotting in three dimensional space of a curve
defined by the parametric equations x = f(t), y = g(t), z = h(t), where
f, g, and h are functions of the parameter t which ranges over a specified
interval. The basic draw command for this function utilizes either the
uncompiled functions or compiled functions format and uses the \spadfun{curve}
command to specify the three functions for the x, y, and z components of
the curve. The general format for uncompiled functions is:
\indent{5}\newline
{\em draw(curve(f(t),g(t),h(t)), t = a..b)}
\indent{0}\newline
where a..b is the segment defining the interval [a,b] over which the
parameter t ranges. In this case the functions are not compiled until the
draw command is executed. Here is an example:
\graphpaste{draw(curve(cos(t),sin(t),t), t=-12..12)}
In the case of compiled functions, the functions are named and compiled
independently. This is useful if you intend to use the functions often, or
if the functions are long and complex. The following lines show functions
whose parameters are of the type Small Float. The functions are compiled and
stored by \Language{} when entered.
\indent{5}\newline
{\em NOTE: It is only necessary to click on the draw command button to plot
this example}.
\indent{0}\newline
\spadpaste{i1(t:SF):SF == sin(t)*cos(3*t/5) \bound{i1}}
\spadpaste{i2(t:SF):SF == cos(t)*cos(3*t/5) \bound{i2}}
\spadpaste{i3(t:SF):SF == cos(t)*sin(3*t/5) \bound{i3}}
Once the functions are compiled the draw command only needs the names of
the functions to execute. Here is a compiled functions example:
\graphpaste{draw(curve(i1,i2,i3),0..15*\%pi) \free{i1 i2 i3}}
Note that the parameter range does not take the variable name as in the
case of uncompiled functions. It is understood that the indicated range
applies to the parameter of the functions, which in this case is t.
\endscroll
\autobuttons \end{page}
% Parametric Tube Plots Graphics Page
\begin{page}{ParametricTubeGraphicsPage}{Parametric Tube Plots}
\beginscroll
This page describes the plotting in three dimensional space of a tube
around a parametric space curve defined by the parametric equations
x = f(t), y = g(t), z = h(t), where f, g, and h are functions of the
parameter t which ranges over a specified interval. The basic draw command
for this function utilizes either the uncompiled functions or compiled
functions format and uses the \spadfun{curve} command to specify the three
functions for the x, y, and z components of the curve. This uses the same
format as that for space curves except that it requires a specification for
the radius of the tube. If the radius of the tube is 0, then the result is
the space curve itself. The general format for uncompiled functions is:
\indent{5}\newline
{\em draw(curve(f(t),g(t),h(t)), t = a..b, tubeRadius == r)}
\indent{0}\newline
where a..b is the segment defining the interval [a,b] over which the
parameter t ranges, and the tubeRadius is indicated by the variable r.
In this case the functions are not compiled until the draw command is
executed. Here is an example:
\graphpaste{draw(curve(sin(t)*cos(3*t/5), cos(t)*cos(3*t/5), cos(t)*sin(3*t/5)), t=0..15*\%pi,tubeRadius == .15)}
In the case of compiled functions, the functions are named and compiled
independently. This is useful if you intend to use the functions often, or
if the functions are long and complex. The following lines show functions
whose parameters are of the type Small Float. The functions are compiled and
stored by \Language{} when entered.
\indent{5}\newline
{\em NOTE: It is only necessary to click on the draw command button to plot
this example}.
\indent{0}\newline
\spadpaste{t1(t:SF):SF == 4/(2-sin(3*t))*cos(2*t) \bound{t1}}
\newline
\spadpaste{t2(t:SF):SF == 4/(2-sin(3*t))*sin(2*t) \bound{t2}}
\newline
\spadpaste{t3(t:SF):SF == 4/(2-sin(3*t))*cos(3*t) \bound{t3}}
\newline
Once the function is compiled the draw command only needs the names of the
functions to execute. Here is a compiled functions example of a trefoil knot:
\graphpaste{draw(curve(t1,t2,t3),0..2*\%pi,tubeRadius == .2) \free{t1 t2 t3}}
Note that the parameter range does not take the variable name as in the
case of uncompiled functions. It is understood that the indicated range
applies to the parameter of the functions, which in this case is t.
Typically, the radius of the tube should be set between 0 and 1. A radius
of less than 0 results in it's positive counterpart and a radius of greater
than one causes self intersection.
\endscroll
\autobuttons \end{page}
% Parametric Surfaces Graphics Page
\begin{page}{ParametricSurfaceGraphicsPage}{Parametric Surfaces}
\beginscroll
Graphing a surface defined by x = f(u,v), y = g(u,v), z = h(u,v). \newline
This page describes the plotting of surfaces defined by the parametric
equations of two variables, x = f(u,v), y = g(u,v), and z = h(u,v),
for which the ranges of u and v are explicitly defined. The basic draw
command for this function utilizes either the uncompiled function or
compiled function format and uses the \spadfun{surface} command to specify the
three functions for the x, y and z components of the surface. The general
format for uncompiled functions is:
\indent{5}\newline
{\em draw(surface(f(u,v),g(u,v),h(u,v)), u = a..b, v = c..d)}
\indent{0}\newline
where a..b and c..d are segments defining the intervals [a,b] and [c,d] over
which the parameters u and v span. In this case the functions are not
compiled until the draw command is executed. Here is an example of a
surface plotted using the parabolic cylindrical coordinate system option:
\graphpaste{draw(surface(u*cos(v), u*sin(v),v*cos(u)),u=-4..4,v=0..2*\%pi,
coordinates== parabolicCylindrical)}
In the case of compiled functions, the functions are named and compiled
independently. This is useful if you intend to use the functions often, or
if the functions are long and complex. The following lines show functions
whose parameters are of the type Small Float. The functions are compiled and
stored by \Language{} when entered.
\indent{5}\newline
{\em NOTE: It is only necessary to click on the draw command button to plot
this example}.
\indent{0}\newline
\spadpaste{n1(u:SF,v:SF):SF == u*cos(v) \bound{n1}}
\newline
\spadpaste{n2(u:SF,v:SF):SF == u*sin(v) \bound{n2}}
\newline
\spadpaste{n3(u:SF,v:SF):SF == u \bound{n3}}
Once the function is compiled the draw command only needs the names of the
functions to execute. Here is a compiled functions example plotted using
the toroidal coordinate system option: \newline
\graphpaste{draw(surface(n1,n2,n3), 1.0..4.0, 1.0..4*\%pi,
coordinates == toroidal(1\$SF)) \free{n1 n2 n3}}
Note that the parameter ranges do not take the variable names as in the
case of uncompiled functions. The variables are entered in the order in
which they are defined in the function specification. In this case the
first range specifies the u-variable and the second range specifies the
v-variable.
\endscroll
\autobuttons \end{page}
% Building 3D Objects Graphics Page
\begin{page}{3DObjectGraphicsPage}{Building 3D Objects}
\beginscroll
This page describes the \Language{} facilities for creating three dimensional
objects constructed from geometric primitives. The \Language{} operation
\spadfun{create3Space()} creates a space to which points, curves, and
polygons can be added using the operations from the \spadtype{ThreeSpace}
domain. The contents of this space can then be displayed in a viewport
using the \spadfun{makeViewport3D()} command. It will be necessary to
have these operations exposed in order to use them. \indent{5}\newline
{\em NOTE: It is only necessary to click on the makeViewport3D command button
to plot this curve example}.
\indent{0}\newline
Initially, the space which will hold the objects must be defined and
compiled, as in the following example:
\spadpaste{space := create3Space()\$(ThreeSpace SF) \bound{space}}
Now objects can be sent to this {\em space} as per the operations allowed by
the \spadtype{ThreeSpace} domain. The following examples place curves into
{\em space}.
\spadpaste{curve(space,[[0,20,20],[0,20,30],[0,30,30],[0,30,100], [0,20,100],[0,20,110],[0,50,110],[0,50,100],[0,40,100], [0,40,30],[0,50,30],[0,50,20],[0,20,20]]) \bound{curveI}}
\newline
\spadpaste{curve(space,[[0,80,20],[0,70,20],[0,70,110],[0,110,110], [0,120,100],[0,120,70],[0,115,65],[0,120,60],[0,120,30], [0,110,20],[0,80,20],[0,80,30],[0,105,30],[0,110,35]]) \bound{curveB1}}
\newline
\spadpaste{curve(space,[[0,110,35],[0,110,55],[0,105,60],[0,80,60],[0,80,70], [0,105,70],[0,110,75],[0,110,95],[0,105,100],[0,80,100], [0,80,30]]) \bound{curveB2}}
\newline
\spadpaste{closedCurve(space,[[0,140,20],[0,140,110],[0,150,110],[0,170,50], [0,190,110],[0,200,110],[0,200,20],[0,190,20],[0,190,75], [0,175,35],[0,165,35],[0,150,75],[0,150,20]]) \bound{curveM}}
\spadpaste{closedCurve(space,[[200,0,20], [200,0,110], [185,0,110], [160,0,45], [160,0,110], [150,0,110], [150,0,20], [165,0,20], [190,0,85], [190,0,20]]) \bound{curveN}}
\spadpaste{closedCurve(space,[[140,0,20], [120,0,110], [110,0,110], [90,0,20], [100,0,20], [108,0,50], [123,0,50], [121,0,60], [110,0,60], [115,0,90], [130,0,20]]) \bound{curveA}}
\spadpaste{closedCurve(space,[[80,0,30], [80,0,100], [70,0,110], [40,0,110], [30,0,100], [30,0,90], [40,0,90], [40,0,95], [45,0,100], [65,0,100], [70,0,95], [70,0,35], [65,0,30], [45,0,30], [40,0,35], [40,0,60], [50,0,60], [50,0,70], [30,0,70], [30,0,30], [40,0,20], [70,0,20]]) \bound{curveG}}
Once {\em space} contains the desired elements a viewport is created and
displayed with the following command:
\graphpaste{makeViewport3D(space,[title("Curves")])\$VIEW3D \free{space curveI curveB1 curveB2 curveM curveN curveA curveG}}
The parameters for \spadfun{makeViewport3D()} in this example are {\em space},
which is the name of the three dimensional space that was defined, and a
string, "curve", which is the title for the viewport. The tailing string
{\em \$VIEW3D} exposes the command \spadfun{makeViewport3D()} from the domain
\spadtype{ThreeDimensionalViewport} if these commands are unexposed.
\endscroll
\autobuttons \end{page}
% Two Dimensional Graphics Page
\begin{page}{TwoDimensionalGraphicsPage}{Two Dimensional Graphics}
\beginscroll