make_point.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /****************************************************************/
  2. /* */
  3. /* make_point.c in ~/src/Glos */
  4. /* */
  5. /* This function allocates memory space for a new point, */
  6. /* initializes the various fields using the values of */
  7. /* the parameters passed and returns the address of this */
  8. /* new point so that it could be attached in the linked */
  9. /* list. */
  10. /* */
  11. /****************************************************************/
  12. #include <grass/gis.h>
  13. #include "point.h"
  14. /* #define NULL 0 should be (char *0), or just let the compiler fix it. */
  15. #define NEW_PT_X NEW_PT->x
  16. #define NEW_PT_Y NEW_PT->y
  17. #define NEW_PT_ORIENTATION NEW_PT->orientation
  18. #define NEW_PT_INCLINATION NEW_PT->inclination
  19. #define NEXT_NEW_PT NEW_PT->next
  20. struct point *make_point(double orientation, double inclination, int y, int x)
  21. {
  22. struct point *NEW_PT;
  23. NEW_PT = (struct point *)G_malloc(sizeof(struct point));
  24. NEW_PT_ORIENTATION = orientation;
  25. NEW_PT_INCLINATION = inclination;
  26. NEW_PT_Y = y;
  27. NEW_PT_X = x;
  28. NEXT_NEW_PT = NULL;
  29. return (NEW_PT);
  30. }
  31. /********* END OF FUNCTION "MAKE_POINT" *************************/