home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / sgi / bugs / 63 < prev    next >
Encoding:
Text File  |  1993-01-04  |  1.6 KB  |  75 lines

  1. Newsgroups: comp.sys.sgi.bugs
  2. Path: sparky!uunet!munnari.oz.au!metro!lois!mike
  3. From: mike@research
  4. Subject: Picking Splines
  5. Message-ID: <1992Dec30.012730.782@research>
  6. Organization: Animal Logic Research, Sydney Australia
  7. Date: Wed, 30 Dec 1992 01:27:30 GMT
  8. Lines: 65
  9.  
  10.  
  11. We have had trouble picking splines using gselect.
  12. We are using an Indigo XS24 R4000 running IRIX4.0.5F.
  13.  
  14. Starting with ~4Dgifts/examples/grafix/select1.c we replaced the
  15. call to drawplanet() with the following piece of code.
  16. The picking works fine on the curve hull (drawn with bgnline,endline)
  17. but not with the actual curve (drawn with crv ).
  18.  
  19. ------ cut here -----------------
  20. static Boolean init_basis = TRUE;
  21. short BEZIER_ID = 1;
  22. const float bezier_basis[4][4] = {
  23.   {-1.0,  3.0, -3.0, 1.0},
  24.   { 3.0, -6.0,  3.0, 0.0},
  25.   {-3.0,  3.0,  0.0, 0.0},
  26.   { 1.0,  0.0,  0.0, 0.0}
  27. };
  28. const float FPS = 30.0;
  29.  
  30.  
  31. void drawplanet()
  32. {
  33.  float X1 = 200.0;
  34.  float Y1 = 200.0;
  35.  float X2 = 400.0;
  36.  float Y2 = 300.0;
  37.  
  38.   float geom[4][3];
  39.  
  40.   if(init_basis) 
  41.   {
  42.     init_basis = FALSE;
  43.     defbasis(BEZIER_ID, bezier_basis);
  44.   }
  45.  
  46.   color( 2 );
  47.  
  48.   curvebasis(BEZIER_ID);
  49.   curveprecision((short)FPS);
  50.  
  51.   geom[0][2] = geom[1][2] = geom[2][2] = geom[3][2] = 0.0;
  52.  
  53.   geom[0][0] = X1; geom[0][1] = Y1;
  54.   geom[1][0] = X1; geom[1][1] = Y2;
  55.   geom[2][0] = X2; geom[2][1] = Y1;
  56.   geom[3][0] = X2; geom[3][1] = Y2;
  57.  
  58.   crv(geom);
  59.  
  60.   bgnline();
  61.   v3f(geom[0]);
  62.   v3f(geom[1]);
  63.   v3f(geom[2]);
  64.   v3f(geom[3]);
  65.   endline();
  66.  
  67. }
  68. ----- end cut --------------
  69.  
  70. Our email address is a bit wonky at the moment so could replies please
  71. be posted to this newsgroup.
  72.  
  73. Thanks,
  74. Mike Murray
  75.