mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-18 03:39:04 -04:00
Fix wonky pyramids
Previously the slope of the pyramid was cast into a double. This adds an error into the value that is provided as an exact rational number. This change keeps the value as a rational and only uses the double type where intermediate values may exceed the integer range.
This commit is contained in:
parent
ab97043dd8
commit
848a0f8d2c
@ -48,7 +48,7 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
int curHeight = Invert ? yy : height - yy;
|
||||
if (curHeight == 0) continue;
|
||||
|
||||
double curRadius = Radius * ((double)curHeight / (double)height);
|
||||
double curRadius = Radius * (double)curHeight / (double)height;
|
||||
int dist = xx * xx + zz * zz;
|
||||
if (dist > curRadius * curRadius) continue;
|
||||
output(Place(x, y, z, brush));
|
||||
@ -80,7 +80,7 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
int curHeight = Invert ? yy : height - yy;
|
||||
if (curHeight == 0) continue;
|
||||
|
||||
double curRadius = Radius * ((double)curHeight / (double)height);
|
||||
double curRadius = Radius * (double)curHeight / (double)height;
|
||||
int dist = xx * xx + zz * zz;
|
||||
if (dist > curRadius * curRadius || dist < (curRadius - 1) * (curRadius - 1)) continue;
|
||||
output(Place(x, y, z, brush));
|
||||
@ -109,7 +109,7 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
int curHeight = height - yy;
|
||||
if (curHeight == 0) continue;
|
||||
|
||||
double curRadius = Radius * ((double)curHeight / (double)height);
|
||||
double curRadius = Radius * (double)curHeight / (double)height;
|
||||
int dist = xx * xx + zz * zz;
|
||||
if (dist > curRadius * curRadius) continue;
|
||||
|
||||
@ -119,4 +119,4 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
int curHeight = Invert ? yy : height - yy;
|
||||
if (curHeight == 0) continue;
|
||||
|
||||
double curRadius = Radius * ((double)curHeight / (double)height);
|
||||
int curRadius = Radius * curHeight / height;
|
||||
if (Math.Abs(xx) > curRadius || Math.Abs(zz) > curRadius) continue;
|
||||
output(Place(x, y, z, brush));
|
||||
}
|
||||
@ -78,7 +78,7 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
int curHeight = Invert ? yy : height - yy;
|
||||
if (curHeight == 0) continue;
|
||||
|
||||
double curRadius = Radius * ((double)curHeight / (double)height);
|
||||
int curRadius = Radius * curHeight / height;
|
||||
int absx = Math.Abs(xx), absz = Math.Abs(zz);
|
||||
if (absx > curRadius || absz > curRadius) continue;
|
||||
if (absx < (curRadius - 1) && absz < (curRadius - 1)) continue;
|
||||
@ -86,4 +86,4 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user