Previous Next Up Title Contents Index Functions Index Top Library

1.8.3. DRAWING A CURVE WITH ANNOTATION USING THE PHIGS "TEXT" PRIMITIVE

	program p83
	include 'PHIGS.H'

	integer scenid, wkid, viewid, segtid, xaxid,yaxid, listid(3)
	real viewpt(4), xp(5),yp(5)
	data wkid , viewid, scenid / 1,1, 10 /
	data segtid,xaxid,yaxid, listid /11,12,13, 11,12,13/
	data zoom   / 0.8 /
	data xmin,ymin, xmax,ymax  / 200.,10.,400.,20. /
	data viewpt /0.,1., 0.,1./
	data xp  /220., 280., 320., 360., 380. /
	data yp  /12.,   14., 13.,   16.,  15. /

c---------------------------------------------------------------------

c	open PHIGURE and X-window workstation (type = 8887) */
	call topph (6)
	call topwk (wkid,30,8887)

c	define 2D working domain
	call tdoma2 (xmin,ymin, xmax,ymax)

c	build a structure with PHIGS
	call popst (segtid)
	call ppl (5,xp,yp)
	call pschh (0.03*(ymax-ymin))
	call pschxp ((xmax-xmin)/(ymax-ymin))
	call ptx (xp(1),yp(1),'P0')
	call ptx (xp(2),yp(2),'P1')
	call ptx (xp(3),yp(3),'P2')
	call ptx (xp(4),yp(4),'P3')
	call ptx (xp(5),yp(5),'P4')
	call pclst 

c	build 2 axes
	call taxyln (xaxid, 200.,10.,0., 400., 0.)
	call tayxln (yaxid, 200.,10.,0.,  20., 0.)

c	define scene
	call TSCENE (scenid,3,listid,viewid)

c	define a centered 2D view 
	call tv2cen (wkid,viewid,0.5,0.5,zoom,viewpt)
	
c	display on workstation
	call ppost (wkid,scenid,1.0)
	call prst (wkid,PALWAY)

c	close workstation and PHIGURE 
	call tclwk (wkid)
	call tclph 
	end

This example shows the use of the "text" primitive in a PHIGS structure. It also demonstrates setting a character height equal to 3% of the domain when it is not square. This % is multiplied by the height of the domain, and the PSCHXP function is called with the domain width/height ratio, in order to compensate for the scene transformation.


Previous Next Up Title Contents Index Functions Index Top Library