@@ -2348,17 +2348,18 @@ public int makeCone(
23482348 final int ceilRadiusX = (int ) Math .ceil (radiusX );
23492349 final int ceilRadiusZ = (int ) Math .ceil (radiusZ );
23502350
2351- double rx2 = Math .pow (radiusX , 2 );
2352- double ry2 = Math .pow (height , 2 );
2353- double rz2 = Math .pow (radiusZ , 2 );
2351+ final double rx2 = Math .pow (radiusX , 2 );
2352+ final double ry2 = Math .pow (radiusZ , 2 );
2353+ final double rz2 = Math .pow (height , 2 );
2354+ final int layers = Math .abs (height );
23542355
23552356 int cx = pos .x ();
23562357 int cy = pos .y ();
23572358 int cz = pos .z ();
23582359
2359- for (int y = 0 ; y < height ; ++y ) {
2360- double ySquaredMinusHeightOverHeightSquared = Math .pow (y - height , 2 ) / ry2 ;
2361- int yy = cy + y ;
2360+ for (int y = 0 ; y < layers ; ++y ) {
2361+ double ySquaredMinusHeightOverHeightSquared = Math .pow (y - layers , 2 ) / ry2 ;
2362+ int yy = height < 0 ? cy - y : cy + y ;
23622363 forX :
23632364 for (int x = 0 ; x <= ceilRadiusX ; ++x ) {
23642365 double xSquaredOverRadiusX = Math .pow (x , 2 ) / rx2 ;
@@ -2380,7 +2381,7 @@ public int makeCone(
23802381 double xNext = Math .pow (x + thickness , 2 ) / rx2 + zSquaredOverRadiusZ - ySquaredMinusHeightOverHeightSquared ;
23812382 double yNext = xSquaredOverRadiusX + zSquaredOverRadiusZ - Math .pow (y + thickness - height , 2 ) / ry2 ;
23822383 double zNext = xSquaredOverRadiusX + Math .pow (z + thickness , 2 ) / rz2 - ySquaredMinusHeightOverHeightSquared ;
2383- if (xNext <= 0 && zNext <= 0 && (yNext <= 0 && y + thickness != height )) {
2384+ if (xNext <= 0 && zNext <= 0 && (yNext <= 0 && y + thickness != layers )) {
23842385 continue ;
23852386 }
23862387 }
0 commit comments