Public feed
#598604
#include<stdio.h>
#include<math.h>
struct Point {
float x;
float y;
float z;
};
struct Face {
struct Point vertex[5]; /* Punkte werden in einer Flaeche zu Ecken, daher vertex */
};
void calcPoints(struct Point *points) {
double r = 1;
double h = r*0.5*(sqrt(5)-1);
points[0].x = 0; points[0].y = -h; points[0].z = -(r+h);
points[1].x = 0; points[1].y = h; points[1].z = -(r+h);
points[2].x = r; points[2].y = -r; points[2].z = -r;
points[3].x = r; points[3].y = r; points[3].z = -r;
points[4].x = -r; points[4].y = r; points[4].z = -r;
};
void groupPointsToFaces(struct Face *faces, struct Point *p) {
faces[0].vertex[0] = p[0];
faces[0].vertex[1] = p[1];
faces[0].vertex[2] = p[3];
faces[0].vertex[3] = p[6];
faces[0].vertex[4] = p[2];
}
int main(int* argc, char** argv) {
struct Point points[20];
struct Face faces[12];
calcPoints(&points);
groupPointsToFaces(&faces, &points);
return 0;
}
[fabiand@fiona tmp]$ CPPFLAGS="-ggdb" make some
cc -ggdb some.c -o some
some.c: In Funktion »main«:
some.c:41: Warnung: Übergabe des Arguments 1 von »calcPoints« von inkompatiblem Zeigertyp
some.c:42: Warnung: Übergabe des Arguments 1 von »groupPointsToFaces« von inkompatiblem Zeigertyp
some.c:42: Warnung: Übergabe des Arguments 2 von »groupPointsToFaces« von inkompatiblem Zeigertyp
[fabiand@fiona tmp]$