Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //angle setup
- float theta = chf('theta'); //-pi/2, pi/2
- float phi = chf('phi'); //-pi,pi
- float twopi = $PI * 2;
- float thetaStep = $PI/pts;
- float phiStep = twopi/pts;
- //decalre point position and array to hold points
- vector pos;
- int globe[];
- //superformula variables
- float a = 1;
- float b = a;
- float m1 = 4;
- float m2 = m1;
- float n1 = 12;
- float n2 = 15;
- float n3 = 15;
- float cosValue, sinValue, cosValue2, sinValue2;
- for(int j=0; j<pts; j++){
- for(int i=0; i<pts; i++){
- //polar to cartesian coordinates
- cosValue = pow(abs(cos((m1*theta)*0.25)/a), n2);
- sinValue = pow(abs(sin((m2*theta)*0.25)/b), n3);
- r1 = pow((cosValue + sinValue), -(1/n1));
- cosValue2 = pow(abs(cos((m1*phi)*0.25)/a), n2);
- sinValue2 = pow(abs(sin((m2*phi)*0.25)/b), n3);
- r2 = pow((cosValue + sinValue), -(1/n1));
- pos.x = (r1 * cos(theta)) * (r2 * cos(phi));
- pos.y = (r1 * sin(theta)) * (r2 * cos(phi));
- pos.z = r2 * sin(phi);
- globe[j] = addpoint(geoself(), pos);
- theta += thetaStep;
- phi += phiStep;
- }
- theta += thetaStep;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement