#include #include #include char Eingabewert; /*--------------------------------------------------------------------*/ /* Auswahlmenue zur Eingabe Standbild oder Rotation. */ /*(Radius variabel oder konstant) */ /*--------------------------------------------------------------------*/ int EingabeArt() { int i=1,a; while(i) { printf("\tBitte geben sie die Darstellungsart ein:\n\n"); printf("\tStandbild, mit konstantem Radius (1)\n"); printf("\tStandbild, mit abnehmendem Radius (2)\n"); printf("\tRotation , mit konstantem Radius (3)\n"); printf("\tRotation , mit abnehmendem Radius (4)\n\n"); printf("\t\tEingabe : "); scanf("%s",&Eingabewert); a=atoi(&Eingabewert); if((a>=1)&&(a<=4)) return a; printf("\n\tFalsche Eingabe!!!\n\n"); } return 0; } /*---------------------------------------------------------------------*/ /* Eingabe des Radius. */ /*---------------------------------------------------------------------*/ double EingabeRadius() { printf("\n\tBitte geben sie den Radius ein: "); scanf("%s",&Eingabewert); /* Umwandlung in Zahlenwert falls keine Zahl eingegeben wurde. */ return atof(&Eingabewert); } /*---------------------------------------------------------------------*/ /* Eingabe des Winkels. */ /*---------------------------------------------------------------------*/ float EingabeWinkel() { printf("\n\tBitte geben sie den Winkel ein: "); scanf("%s",&Eingabewert); /* Umwandlung in Zahlenwert falls keine Zahl eingegeben wurde. */ return atof(&Eingabewert); } /*---------------------------------------------------------------------------*/ /* Berechnung des x-oder y-Wertes. */ /*---------------------------------------------------------------------------*/ float Berechnung(float radius,float alpha,int i) { float Pi = 3.1415926535; if(i==0) return (radius*pow(cos(alpha*Pi/180),3)); else return (radius*pow(sin(alpha*Pi/180),3)); } /*---------------------------------------------------------------------------*/ /* Berechnung des neuen x- oder y-Wertes. */ /*---------------------------------------------------------------------------*/ float RotBerechnung(float x,float y,float alpha,int i) { float z=x; if(i==0) return (x=(x*cos(alpha))-(y*sin(alpha))); else return (y=(z*sin(alpha))+(y*cos(alpha))); }