home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / graphics / 8072 < prev    next >
Encoding:
Internet Message Format  |  1992-07-23  |  958 b 

  1. Path: sparky!uunet!darwin.sura.net!dtix!relay!afterlife!adm!amsaa-cleo!neiderer
  2. From: neiderer@amsaa-seer.brl.mil (Andrew Neiderer )
  3. Newsgroups: comp.graphics
  4. Subject: Graphics Gems
  5. Message-ID: <8242@amsaa-cleo.brl.mil>
  6. Date: 23 Jul 92 08:43:21 GMT
  7. Sender: news@amsaa-cleo.brl.mil
  8. Lines: 21
  9.  
  10.  
  11. Can anyone tell me why some vector functions, such as 
  12.  
  13. Vector2 *V2Add(a, b, c)
  14. Vector2 *a, *b, *c;
  15. {
  16.         c->x = a->x+b->x;  c->y = a->y+b->y;
  17.         return(c);
  18.         };
  19.  
  20. return the pointer to the resultant vector.  I would 
  21. just declare it as void since c already contains the
  22. answer.  There must be some advantage to doing it this way.
  23. I looked throughout the Graphics Gems source code, and
  24. found that this particular function is used, e.g. as
  25.  
  26. V2Add(&bezCurve[0],V2Scale(&tHat1, dist),&bezCurve[1]);
  27.  
  28. Sorry if this appears to be a C question.  My reason for 
  29. posting here is to get the attention of some graphics 
  30. programmer who uses this stuff.  Thanks.
  31.