00001 // $Header: /nfs/slac/g/glast/ground/cvs/geomrep/src/HypeRep.cxx,v 1.2 2001/01/23 01:40:12 burnett Exp $ 00002 // Author: Toby Burnett 00003 // 00004 // Display of a Hype with Arve Visualization 00005 00006 #include "geomrep/HypeRep.h" 00007 #include "geometry/Hype.h" 00008 00009 00010 void HypeRep::update() 00011 { 00012 /* 00013 // Create a representation to draw a Hype by calculating the 00014 // vertices of polylines used to display a Hype and storing them 00015 // in arrays. 00016 // To make the drawing less confusing, just draw the inner surface, 00017 // with circles represented by 24-sided polygons at each end, connected 00018 // by four hyperbolas represented by polylines with 48 segments. 00019 Vector v1[25]; // array for 24-sided polygon for +z circle 00020 Vector v2[25]; // array for 24-sided polygon for -z circle 00021 Vector v3[49]; // array for drawing hyperbolas 00022 // Calculate vertices of the polygons for the circles in the local coordinate 00023 // system, then transform them to the global system. 00024 int i, j, n = 25; 00025 double phi = 0.0; 00026 double dphi = 2.0 * M_PI / ( n - 1 ); 00027 double vx, vy; 00028 Vector vt1, vt2; 00029 for ( i = 0; i < n; i++ ) { 00030 phi = i * dphi; 00031 vx = inner_radius * cos( phi ); 00032 vy = inner_radius * sin( phi ); 00033 vt1 = Vector( vx, vy, half_length ); 00034 v1[i] = localToGlobal( vt1 ); 00035 vt2 = Vector( vx, vy, -half_length ); 00036 v2[i] = localToGlobal( vt2 ); 00037 } 00038 // Draw the polylines for the circles. 00039 createPolyLine( v1, 25 ); 00040 createPolyLine( v2, 25 ); 00041 // 00042 // Now calculate and draw the four hyperbolas. 00043 Vector vt; 00044 n = 49; 00045 double z = -half_length; 00046 double dz = 2.0 * half_length / n; 00047 AntiHyperbolic* ah = (AntiHyperbolic *)surface_list->first(); 00048 double ca, sa, rz, lx, ly; 00049 for ( i = 0; i < 4; i++ ) { 00050 ca = 0.0; 00051 sa = 0.0; 00052 if ( i == 1 ) 00053 ca = 1.0; 00054 if ( i == 2 ) 00055 sa = 1.0; 00056 if ( i == 3 ) 00057 ca = -1.0; 00058 if ( i == 4 ) 00059 sa = -1.0; 00060 for ( j = 0; j < n; j++ ) { 00061 rz = ah->r_of_z( z ); 00062 lx = rz * ca; 00063 ly = rz * sa; 00064 vt = Vector( lx, ly, z ); 00065 v3[j] = localToGlobal( vt ); 00066 z += dz; 00067 } 00068 createPolyLine( v3, n ); 00069 } 00070 00071 */ 00072 } 00073
1.2.3 written by Dimitri van Heesch,
© 1997-2000