- int segments = 64;
- double thetaSegment = PI / (double) segments;
- double phiSegment = TAU / (double) segments;
-
- for (double phi = 0.0D; phi < TAU; phi += phiSegment) {
- for (double theta = 0.0D; theta < PI; theta += thetaSegment) {
- double dx = radius * Math.sin(phi) * Math.cos(theta);
- double dz = radius * Math.sin(phi) * Math.sin(theta);
- double dy = radius * Math.cos(phi);
+ for (double phi = 0.0D; phi < TAU; phi += PHI_SEGMENT) {
+ double dy = radius * Math.cos(phi);
+ double radiusBySinPhi = radius * Math.sin(phi);
+ for (double theta = 0.0D; theta < PI; theta += THETA_SEGMENT) {
+ double dx = radiusBySinPhi * Math.cos(theta);
+ double dz = radiusBySinPhi * Math.sin(theta);