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.

40 lines
778 B

/**
* Funktionen von 'Laenge einer Strecke im Raum'
*
* Rainer Hihn
*/
#include "strecke.h"
struct point readPoint()
{
struct point userPoint;
printf("Bitte x-Koordinate eingeben \n");
scanf("%62f", &userPoint.rX);
printf("Bitte y-Koordinate eingeben \n");
scanf("%62f", &userPoint.rY);
printf("Bitte z-Koordinate eingeben \n");
scanf("%62f", &userPoint.rZ);
return userPoint;
}
float distance(struct point point1, struct point point2)
{
float rNewX = 0;
float rNewY = 0;
float rNewZ = 0;
float rDistance = 0;
rNewX = point1.rX - point2.rX;
rNewY = point1.rY - point2.rY;
rNewZ = point1.rZ - point2.rZ;
rDistance = sqrt((rNewX * rNewX) + (rNewY * rNewY) + (rNewZ * rNewZ));
return rDistance;
}