home *** CD-ROM | disk | FTP | other *** search
- #ifndef lint
- static char sccsid[] = "@(#)draw_hsi_xgl.c 1.2 92/05/28 SMI" ;
- /* from draw_hsi_xgl.c 1.1 90/07/23 SMI */
- #endif
-
- /*
- * Copyright (c) 1986 by Sun Microsystems, Inc.
- */
-
- /*
- * this file draws the hsi
- */
-
-
-
- #include <stdio.h>
- #include <math.h>
- #include "graphics.h"
- #include "dstar.h"
-
- extern int debug_level ;
-
- #include "hsi.h"
-
- static int initialized = 0 ;
- static Xgl_pt_list lon_pt[NLON] ;
- static Xgl_pt_list lat_pt[NLAT] ;
- static Xgl_circle_list circle ;
- static Xgl_circle_f2d circle_dat ;
- static Xgl_bbox my_bbox ;
- static Xgl_trans scale_trans ;
- static Mat3d scale_mat = {{1.,0.,0.,0.},{0.,1.,0.,0.},
- {0.,0.,-1.,0.},{0.,0.,0.,1.}} ;
-
-
- hsi_init()
- {
- int i ;
- Xgl_pt_list tmp ;
-
- my_bbox.bbox_type = XGL_BBOX_F3D ;
- my_bbox.box.f3d.xmin = -1. ;
- my_bbox.box.f3d.xmax = 1. ;
- my_bbox.box.f3d.ymin = -1. ;
- my_bbox.box.f3d.ymax = 1. ;
- my_bbox.box.f3d.zmin = -1. ;
- my_bbox.box.f3d.zmax = 1. ;
-
- for(i=0; i<NLON; ++i)
- {
- lon_pt[i].pt_type = XGL_PT_F3D ;
- lon_pt[i].bbox = &my_bbox ;
- lon_pt[i].num_pts = i%2 ? NLAT : NLAT+2 ;
- lon_pt[i].pts.f3d = &lons[i][i%2] ;
- }
- tmp = lon_pt[1] ;
- lon_pt[1] = lon_pt[NLON/2] ;
- lon_pt[NLON/2] = tmp ;
-
- for(i=0; i<NLAT; ++i)
- {
- lat_pt[i].pt_type = XGL_PT_F3D ;
- lat_pt[i].bbox = &my_bbox ;
- lat_pt[i].num_pts = NLON+1 ;
- lat_pt[i].pts.f3d = lats[i] ;
- }
-
- circle.num_circles = 1 ;
- circle.type = XGL_MULTICIRCLE_F2D ;
- circle.bbox = &my_bbox ;
- circle.circles.f2d = &circle_dat ;
- circle_dat.center.x = 0. ;
- circle_dat.center.y = 0. ;
- circle_dat.radius = 1 ;
-
- initialized = 1 ;
-
- scale_trans = xgl_transform_create(0) ;
- xgl_transform_write(scale_trans, scale_mat) ;
- }
-
-
- draw_hsi(ctx)
- register Xgl_3d_ctx ctx ;
- {
- int i,j ;
- int color ;
- int flag ;
- Pt3d p1,p2,p3,p4,p5 ;
- register Pt3d *ptr ;
- int fit ;
- Mat3d matrix ;
-
- if( !initialized )
- hsi_init() ;
-
- xgl_object_set(ctx,
- XGL_CTX_LOCAL_MODEL_TRANS, scale_trans,
- XGL_CTX_GLOBAL_MODEL_TRANS, ROT_MAT,
- XGL_CTX_CLIP_PLANES, 0x3f,
- 0 ) ;
-
- Set_color(ctx,LGREY) ;
-
- #ifdef COMMENT
- xgl_multicircle(ctx, &circle) ;
- #endif COMMENT
-
- /* draw longitude lines */
-
- Set_color(ctx,RED) ;
- xgl_multipolyline(ctx, NULL, 1, &lon_pt[0]) ;
-
- Set_color(ctx,GREEN) ;
- xgl_multipolyline(ctx, NULL, 1, &lon_pt[1]) ;
-
- Set_color(ctx,LGREY) ;
- xgl_multipolyline(ctx, NULL, NLON-2, &lon_pt[2]) ;
-
-
- /* draw lattitude lines */
-
- xgl_multipolyline(ctx, NULL, (NLAT+1)/2, lat_pt) ;
-
- Set_color(ctx,RED) ;
- xgl_multipolyline(ctx, NULL, NLAT-((NLAT+1)/2), &lat_pt[(NLAT+1)/2]) ;
- }
-