You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
778 B

  1. /**
  2. * Funktionen von 'Laenge einer Strecke im Raum'
  3. *
  4. * Rainer Hihn
  5. */
  6. #include "strecke.h"
  7. struct point readPoint()
  8. {
  9. struct point userPoint;
  10. printf("Bitte x-Koordinate eingeben \n");
  11. scanf("%62f", &userPoint.rX);
  12. printf("Bitte y-Koordinate eingeben \n");
  13. scanf("%62f", &userPoint.rY);
  14. printf("Bitte z-Koordinate eingeben \n");
  15. scanf("%62f", &userPoint.rZ);
  16. return userPoint;
  17. }
  18. float distance(struct point point1, struct point point2)
  19. {
  20. float rNewX = 0;
  21. float rNewY = 0;
  22. float rNewZ = 0;
  23. float rDistance = 0;
  24. rNewX = point1.rX - point2.rX;
  25. rNewY = point1.rY - point2.rY;
  26. rNewZ = point1.rZ - point2.rZ;
  27. rDistance = sqrt((rNewX * rNewX) + (rNewY * rNewY) + (rNewZ * rNewZ));
  28. return rDistance;
  29. }