home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 3 / RISC_DISC_3.iso / resources / etexts / gems / gemsv / ch6_4 / pt2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-22  |  584 b   |  23 lines

  1. #include "pt2.h"
  2.  
  3. /*************************************************************/
  4. /*                                                           */
  5. /* Two utility functions to add and subtract 2D integer      */
  6. /* points.                                                   */
  7. /*                                                           */
  8. /*************************************************************/
  9.  
  10. pt2* addPt2(pt2 *a, pt2 *b, pt2 *c)
  11. {
  12. c->x = a->x + b->x;
  13. c->y = a->y + b->y;
  14. return c;
  15. }
  16.  
  17. pt2* subPt2(pt2 *a, pt2 *b, pt2 *c)
  18. {
  19. c->x = a->x - b->x;
  20. c->y = a->y - b->y;
  21. return c;
  22. }
  23.