prlisp.hlp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. PRLISP.HLP
  2. ----------
  3. Picture RLISP is an Algol-like graphics language, for Teleray, HP2648a
  4. and Tektronix, in which graphics Model primitives are combined into
  5. complete Models for display. It is a loadable option (Load PRLISP).
  6. Model primitives include:
  7. P:={x,y,z}; A point (y, and z may be omitted, default to 0)
  8. PS:=P1_ P2_ ... Pn; A Point Set is an ordered set of Points (Polygon)
  9. G := PS1 & PS2 & ... PSn; A Group of Polygons.
  10. Point Set Modifiers alter the interpretation of Point Sets within their scope.
  11. BEZIER() causes the point-set to be interpreted as the specification points
  12. for a BEZIER curve, open pointset.
  13. BSPLINE() does the same for a Bspline curve, closed pointset
  14. TRANSFORMS: Mostly return a transformation matrix
  15. Translation: Move the specified amount along the specified axis.
  16. XMOVE (deltaX) ; YMOVE (deltaY) ; ZMOVE (deltaZ)
  17. MOVE (deltaX, deltaY, deltaZ)
  18. Scale : Scale the Model SCALE (factor)
  19. XSCALE (factor) ; YSCALE (factor) ; ZSCALE (factor)
  20. SCALE1 (x.scale.factor, y.scale.factor, z.scale.factor)
  21. SCALE <Scale factor>. Scale along all axes.
  22. Rotation:
  23. ROT (degrees) ; ROT (degrees, point.specifying.axis)
  24. XROT (degrees) ; YROT (degrees) ; ZROT (degrees)
  25. Window (z.eye,z.screen):
  26. The WINDOW primitives assume that the viewer is located along the z
  27. axis looking in the positive z direction, and that the viewing window is to
  28. be centered on both the x and y axis.
  29. Vwport(leftclip,rightclip,topclip,bottomclip):
  30. The VWPORT, which specifies the region of the screen which is used for
  31. display.
  32. REPEATED (number.of.times, my.transform),
  33. The section of the Model which is contained within the scope of the Repeat
  34. Specification is replicated. Note that REPEATED is intended to duplicate a
  35. sub-image in several different places on the screen; it was not designed
  36. for animation.
  37. Identifiers of other Models,
  38. the Model referenced is
  39. displayed as if it were part of the current Model for dynamic display.
  40. Calls to PictureRLISP Procedures
  41. This Model primitive allows procedure calls to be imbedded within Models.
  42. When the Model interpreter reaches the procedure identifier it calls it,
  43. passing it the portion of the Model below the procedure as an argument.
  44. The current transformation matrix and the current pen position are available
  45. to such procedures as the values of the global identifiers
  46. GLOBAL!.TRANSFORM and HEREPOINT.
  47. If normal procedure call syntax, i.e. proc.name@ (parameters), is used
  48. then the procedure is called at Model-building time, but if only the
  49. procedure's identifier is used then the procedure is imbedded in the Model.
  50. ERASE() Clears the screen and leaves the cursor at the origin.
  51. SHOW (pict) Takes a picture and display it on the screen
  52. ESHOW (pict) Erases the whole screen and display "pict"
  53. HP!.INIT(), TEK!.INIT(), TEL!.INIT()
  54. Initializes the operating system's (TOPS-20) view
  55. of the characteristics of HP2648A terminal, TEKTRONIX 4006-1
  56. (also ADM-3A with Retrographics board, and Teleray-1061
  57. HP!.BUILDP() Picture construction on the screen
  58. For example, the Model
  59. (A _ B _ C & {1,2} _ B) | XROT (30) | 'TRAN ;
  60. %
  61. % PictureRLISP Commands to SHOW lots of Cubes
  62. %
  63. % Outline is a Point Set defining the 20 by 20
  64. % square which will be part of the Cubeface
  65. %
  66. Outline := { 10, 10} _ {-10, 10} _
  67. {-10,-10} _ { 10,-10} _ {10, 10};
  68. % Cubeface will also have an Arrow on it
  69. %
  70. Arrow := {0,-1} _ {0,2} & {-1,1} _ {0,2} _ {1,1};
  71. % We are ready for the Cubeface
  72. Cubeface := (Outline & Arrow) | 'Tranz;
  73. % Note the use of static clustering to keep objects
  74. % meaningful as well as the quoted Cluster
  75. % to the as yet undefined transformation Tranz,
  76. % which will result in its evaluation being
  77. % deferred until SHOW time
  78. % and now define the Cube
  79. Cube := Cubeface
  80. & Cubeface | XROT (180) % 180 degrees
  81. & Cubeface | YROT ( 90)
  82. & Cubeface | YROT (-90)
  83. & Cubeface | XROT ( 90)
  84. & Cubeface | XROT (-90);
  85. % In order to have a more pleasant look at
  86. % the picture shown on the screen we magnify
  87. % cube by 5 times.
  88. BigCube := Cube | SCALE 5;
  89. % Set up initial Z Transform for each cube face
  90. %
  91. Tranz := ZMOVE (10); % 10 units out
  92. %
  93. % GLOBAL!.TRANSFORM has been treated as a global variable.
  94. % GLOBAL!.TRANSFORM should be initialized as a perspective
  95. % transformation matrix so that a viewer can have a correct
  96. % look at the picture as the viewing location changed.
  97. % For instance, it may be set as the desired perspective
  98. % with a perspective window centered at the origin and
  99. % of screen size 60, and the observer at -300 on the z axis.
  100. % Currently this has been set as default perspective transformation.
  101. % Now draw cube
  102. %
  103. SHOW BigCube;
  104. %@hinge
  105. % Draw it again rotated and moved left
  106. %
  107. SHOW (BigCube | XROT 20 | YROT 30 | ZROT 10);
  108. % Dynamically expand the faces out
  109. %
  110. Tranz := ZMOVE 12;
  111. %
  112. SHOW (BigCube | YROT 30 | ZROT 10);
  113. % Now show 5 cubes, each moved further right by 80
  114. %
  115. Tranz := ZMOVE 10;
  116. %
  117. SHOW (Cube | SCALE 2.5 | XMOVE (-240) | REPEATED(5, XMOVE 80));
  118. %
  119. % Now try pointset modifier.
  120. % Given a pointset (polygon) as control points either a BEZIER or a
  121. % BSPLINE curve can be drawn.
  122. %
  123. Cpts := {0,0} _ {70,-60} _ {189,-69} _ {206,33} _ {145,130} _ {48,130}
  124. _ {0,84} $
  125. %
  126. % Now draw Bezier curve
  127. % Show the polygon and the Bezier curve
  128. %
  129. SHOW (Cpts & Cpts | BEZIER());
  130. % Now draw Bspline curve
  131. % Show the polygon and the Bspline curve
  132. %
  133. SHOW (Cpts & Cpts | BSPLINE());
  134. % Now work on the Circle
  135. % Given a center position and a radius a circle will be drawn
  136. %
  137. SHOW ( {10,10} | CIRCLE(50));
  138. %
  139. % Define a procedure which returns a model of
  140. % a Cube when passed the face to be used
  141. %
  142. Symbolic Procedure Buildcube;
  143. List 'Buildcube;
  144. % put the name onto the property list
  145. Put('buildcube, 'pbintrp, 'Dobuildcube);
  146. Symbolic Procedure Dobuildcube Face$
  147. Face & Face | XROT(180)
  148. & Face | YROT(90)
  149. & Face | YROT(-90)
  150. & Face | XROT(90)
  151. & Face | XROT(-90) ;
  152. % just return the value of the one statement
  153. % Use this procedure to display 2 cubes, with and
  154. % without the Arrow - first do it by calling
  155. % Buildcube at time the Model is built
  156. %
  157. P := Cubeface | Buildcube() | XMOVE(-15) &
  158. (Outline | 'Tranz) | Buildcube() | XMOVE 15;
  159. %
  160. SHOW (P | SCALE 5);
  161. % Now define a procedure which returns a Model of
  162. % a cube when passed the half size parameter
  163. Symbolic Procedure Cubemodel;
  164. List 'Cubemodel;
  165. %put the name onto the property list
  166. Put('Cubemodel,'Pbintrp, 'Docubemodel);
  167. Symbolic Procedure Docubemodel HSize;
  168. << if idp HSize then HSize := eval HSize$
  169. { HSize, HSize, HSize} _
  170. {-HSize, HSize, HSize} _
  171. {-HSize, -HSize, HSize} _
  172. { HSize, -HSize, HSize} _
  173. { HSize, HSize, HSize} _
  174. { HSize, HSize, -HSize} _
  175. {-HSize, HSize, -HSize} _
  176. {-HSize, -HSize, -HSize} _
  177. { HSize, -HSize, -HSize} _
  178. { HSize, HSize, -HSize} &
  179. {-HSize, HSize, -HSize} _
  180. {-HSize, HSize, HSize} &
  181. {-HSize, -HSize, -HSize} _
  182. {-HSize, -HSize, HSize} &
  183. { HSize, -HSize, -HSize} _
  184. { HSize, -HSize, HSize} >>;
  185. % Imbed the parameterized cube in some Models
  186. %
  187. His!.cube := 'His!.size | Cubemodel();
  188. Her!.cube := 'Her!.size | Cubemodel();
  189. R := His!.cube | XMOVE (60) &
  190. Her!.cube | XMOVE (-60) ;
  191. % Set up some sizes and SHOW them
  192. His!.size := 50;
  193. Her!.size := 30;
  194. %
  195. SHOW R ;
  196. %
  197. % Set up some different sizes and SHOW them again
  198. %
  199. His!.size := 35;
  200. Her!.size := 60;
  201. %
  202. SHOW R;
  203. %
  204. % Now show a triangle rotated 45 degree about the z axis.
  205. Rotatedtriangle := {0,0} _ {50,50} _
  206. {100,0} _ {0,0} | Zrot (45);
  207. %
  208. SHOW Rotatedtriangle;
  209. %
  210. % Define a procedure which returns a model of a Pyramid
  211. % when passed 4 vertices of a pyramid.
  212. % Procedure Second,Third, Fourth and Fifth are primitive procedures
  213. % written in the source program which return the second, the third,
  214. % the fourth and the fifth element of a list respectively.
  215. % This procedure simply takes 4 points and connects the vertices to
  216. % show a pyramid.
  217. Symbolic Procedure Pyramid (Point4); %.point4 is a pointset
  218. Point4 &
  219. Third Point4 _
  220. Fifth Point4 _
  221. Second Point4 _
  222. Fourth Point4 ;
  223. % Now give a pointset indicating 4 vertices build a pyramid
  224. % and show it
  225. %
  226. My!.vertices := {-40,0} _ {20,-40} _ {90,20} _ {70,100};
  227. My!.pyramid := Pyramid Vertices;
  228. %
  229. SHOW ( My!.pyramid | XROT 30);
  230. %
  231. % A procedure that makes a wheel with "count"
  232. % spokes rotated around the z axis.
  233. % where "count" is the number specified.
  234. Symbolic Procedure Dowheel(spoke,count)$
  235. begin scalar rotatedangle$
  236. count := first count$
  237. rotatedangle := 360.0 / count$
  238. return (spoke | REPEATED(count, ZROT rotatedangle))
  239. end$
  240. %
  241. % Now draw a wheel consisting of 8 cubes
  242. %
  243. Cubeonspoke := (Outline | ZMOVE 10 | SCALE 2) | buildcube();
  244. Eight!.cubes := Cubeonspoke | XMOVE 50 | WHEEL(8);
  245. %
  246. SHOW Eight!.cubes;
  247. %
  248. %Draw a cube where each face consists of just
  249. % a wheel of 8 Outlines
  250. %
  251. Flat!.Spoke := outline | XMOVE 25$
  252. A!.Fancy!.Cube := Flat!.Spoke | WHEEL(8) | ZMOVE 50 | Buildcube()$
  253. %
  254. SHOW A!.Fancy!.Cube;
  255. %
  256. % Redraw the fancy cube, after changing perspective by
  257. % moving the observer farther out along Z axis
  258. %
  259. GLOBAL!.TRANSFORM := WINDOW(-500,60);
  260. %
  261. SHOW A!.Fancy!.Cube;
  262. %
  263. % Note the flexibility resulting from the fact that
  264. % both Buildcube and Wheel simply take or return any
  265. % Model as their argument or value
  266. How to Run PictureRLISP on HP2648A and TEKTRONIX 4006-1
  267. computer display terminal
  268. The current version of PictureRLISP runs on HP2648A graphics terminal and
  269. TEKTRONIX 4006-1 computer display terminal. The screen of the HP terminal
  270. is 720 units long in the X direction, and 360 units high in the Y
  271. direction. The coordinate system used in HP terminal places the origin in
  272. approximately the center of the screen, and uses a domain of -360 to 360
  273. and a range of -180 to 180. Similarly, the screen of the TEKTRONIX
  274. terminal is 1024 units long in the X direction, and 780 units high in the Y
  275. direction. The same origin is used but the domain is -512 to 512 in the X
  276. direction and the range is -390 to 390 in the Y direction.
  277. Procedures HP!.INIT and TEK!.INIT were used to set the terminals to graph
  278. mode and initiate the lower level procedures on HP and TEKTRONIX terminals
  279. respectively. Basically, INIT procedures were written for different
  280. terminals depending on their specific characteristics. Using INIT
  281. procedures keeps terminal device dependence at the user's level to a
  282. mininum.