Previous Next Up Title Contents Index Functions Index Top Library

1.7.7. DRAWING A PARALLELEPIPED ON 2 WORKSTATIONS

#include <phigure.h>

main()
{
	Pfloat	zoom=1.0; 
	Pint	ws1_id=1, ws2_id=2, view_ind=1, 
		scene_id=10, cube_id=11, system_id=12;

	static	Plimit3 viewport  = {0.,1.,0.,1.,0.,1.}, domain={10.,20.,10.,30.,5.,35.};
	static	Ppoint3 first_corner={10.,10.,5.},second_corner={20.,30.,35.},
		domain_center={15.,20.,20.}, view_center={0.5,0.5,0.5};

	static	Pint struct_ids[2];
	static	Pint_list struct_id_list = {2,struct_ids};
 
/* open PHIGURE */
	topen_phigure (PDEF_ERR_FILE);

/* define 2D working domain */
	tdomain3(&domain);

/* build parallelepiped */
	tcube (cube_id,&first_corner,&second_corner);

/* build system with a type of dotted line */
	tcoordinate_system_axis (system_id, &domain_center,&second_corner,"X","Y","Z",0.1,0.1);
	tset_linetype (system_id,-1,PLINE_DASH);

/* define scene */
	struct_ids[0] = cube_id;
	struct_ids[1] = system_id;
	tscene (scene_id,&struct_id_list,view_ind);
	tset_text_font (scene_id,0,1);

/* plot on the first workstation */
	topen_ws (ws1_id,PDEF_ERR_FILE,8887);
	tview3_perspect_z_vert (ws1_id,view_ind,&view_center,55.,25.,3.0,zoom,&viewport);
	ppost_struct(ws1_id,scene_id,1.);
	predraw_all_structs(ws1_id,PFLAG_ALWAYS);

/* plot on the second workstation */
	topen_ws (ws2_id,PDEF_ERR_FILE,8887);
	tview3_perspect_z_vert (ws2_id,view_ind,&view_center,75.,25.,3.0,zoom,&viewport);
	ppost_struct(ws2_id,scene_id,1.);
	predraw_all_structs(ws2_id,PFLAG_ALWAYS);

/* close workstations and PHIGURE */
	tclose_ws (ws1_id);
	tclose_ws (ws2_id);
	tclose_phigure ();
}

To create images of the same objects on 2 different windows, open two workstations. The dimensions of the windows are defined in the GPHIGS.def file read when PHIGURE is opened.

This program defines a different image of the view_ind view index on each of the workstations. This is used to display the same objects from two different angles.


Previous Next Up Title Contents Index Functions Index Top Library