Previous Next Up Title Contents General Index Functions Index Bookshelf

1.8.3. TRACÉ D'UNE COURBE AVEC ANNOTATION PAR LA PRIMITIVE "TEXT" DE PHIGS


	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	ouverture de PHIGURE et du poste de travail */
	call topph (6)
	call topwk (wkid,30,8887)

c	definition du domaine 2D de travail
	call tdoma2 (xmin,ymin, xmax,ymax)

c	construction d'une structure par 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	construction de deux axes
	call taxyln (xaxid, 200.,10.,0., 400., 0.)
	call tayxln (yaxid, 200.,10.,0.,  20., 0.)

	call tscene (scenid,3,listid,viewid)

c	definition d'une vue centree 2D 
	call tv2cen (wkid,viewid,0.5,0.5,zoom,viewpt)
	
c	trace sur le poste de travail 
	call ppost (wkid,scenid,1.0)
	call prst (wkid,PALWAY)

c	fermeture du poste de travail et de PHIGURE 
	call tclwk (wkid)
	call tclph 
	end

Cet exemple illustre l'utilisation de la primitive "text" dans une structure PHIGS. On remarque de plus comment imposer une hauteur des caractères égal à 3% du domaine lorsque celui-ci n'est pas carré. Il faut multiplier ce % par la hauteur du domaine, et appeler la fonction PSCHXP avec le rapport largeur/hauteur du domaine, afin de compenser la transformation de scène.


Previous Next Up Title Contents General Index Functions Index Bookshelf