Previous Next Up Title Contents Index Functions Index Top Library

1.7.8. DRAWING A PARALLELEPIPED WITH REAL DIMENSIONS

	program p78
	include 'PHIGS.H'

	integer wkid, viewid, scenid,cubid,systid, listid(2)
	real viewpt(6)
	data wkid, viewid, scenid  / 1, 1, 10/
	data cubid,systid,listid /11,12, 11,12/
	data zoom                  / 1.0 /
	data xmin,ymin,zmin, xmax,ymax,zmax  / 10.,10.,5., 20.,30.,35. /
	data viewpt /0.,1., 0.,1., 0.,1./

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

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

c	define a cubic 3D working domain
	size = max(xmax-xmin,ymax-ymin)
	size = max(size,zmax-zmin)/2.0
	xmid = (xmin+xmax)/2.0
	ymid = (ymin+ymax)/2.0
	zmid = (zmin+zmax)/2.0
	xmindo = xmid - size
	xmaxdo = xmid + size
	ymindo = ymid - size
	ymaxdo = ymid + size
	zmindo = zmid - size
	zmaxdo = zmid + size
	call tdoma3 (xmindo,ymindo,zmindo, xmaxdo,ymaxdo,zmaxdo)

c	build parallelepiped
	call tcube (cubid, xmin,ymin,zmin, xmax,ymax,zmax)

c	build dotted line-type marker
	call tcosya (systid, xmid,ymid,zmid ,xmax,ymax,zmax,
	+            'X','Y','Z', 0.1,0.1)

c	insert a PHIGS-type line attribute in the structure 
	call tsln (systid,-1,PLDASH)

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

c	define a centered 2D view 
	call tv3spz (wkid,viewid,0.5,0.5,0.5,55.,25.,3.0,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 program is identical to n°6, but the domain is cubic in order to avoid scene transformations. The cube is calculated by identifying the smallest cube capable of containing the parallelipiped defined by the data, itself centered within the cube.


Previous Next Up Title Contents Index Functions Index Top Library