2010-08-24 4 views
1

Je comprends que y = x^n serait float y = (x, n) mais si je voulais dessiner les courbesDessin la courbe y = 1 - x^4 Traitement/Java

y = 1 - x^4 
y = (1-x)^4 
y = 1-(1-x)^4 

Voici le code je l'ai écrit, mais il n » t tracer la courbe mathématique correcte pour y = 1 - x^4

for (int x = 0; x < 100; x++) { 
    float n = norm(x, 0.0, 100.0); 
    float y = pow(1-n, 4); 
    y *= 100; 
    smooth(); 
    point(x, y); 
} 

Répondre

7

vous rendant dessiner (1-x)^4

vous voulez changer float y = pow(1-n, 4); à float y = 1-pow(n, 4);

+0

merci. tu as raison. –