fix: visualize cylinder

This commit is contained in:
Keisuke Hirata 2025-12-19 23:20:24 +09:00
parent 637f2cdf0a
commit d27057dc89
2 changed files with 3 additions and 6 deletions

View File

@ -146,14 +146,11 @@ class VisualizerTask(
val centerX = cylinder.x + 0.5 val centerX = cylinder.x + 0.5
val centerZ = cylinder.z + 0.5 val centerZ = cylinder.z + 0.5
// Use actual radius (radius + 0.5) for visualization
val actualRadius = cylinder.radius + 0.5
// Y coordinates use block boundaries (no +0.5 offset) // Y coordinates use block boundaries (no +0.5 offset)
val bottomY = cylinder.y.toDouble() - cylinder.bottomHeight val bottomY = cylinder.y.toDouble() - cylinder.bottomHeight
val topY = cylinder.y.toDouble() + 1.0 + cylinder.topHeight val topY = cylinder.y.toDouble() + 1.0 + cylinder.topHeight
GeometryVisualizer.drawCylinder(player, centerX, 0.0, centerZ, actualRadius, bottomY, topY) GeometryVisualizer.drawCylinder(player, centerX, 0.0, centerZ, cylinder.radius.toInt(), bottomY, topY)
// Draw block-aligned boundary (Red) // Draw block-aligned boundary (Red)
val faceBlocks = mutableSetOf<Pair<Int, Int>>() val faceBlocks = mutableSetOf<Pair<Int, Int>>()

View File

@ -35,8 +35,8 @@ object GeometryVisualizer {
drawLine(player, minX, minY, maxZ, minX, maxY, maxZ, edgeColor, step) drawLine(player, minX, minY, maxZ, minX, maxY, maxZ, edgeColor, step)
} }
fun drawCylinder(player: Player, centerX: Double, centerY: Double, centerZ: Double, radius: Double, minY: Double, maxY: Double) { fun drawCylinder(player: Player, centerX: Double, centerY: Double, centerZ: Double, radius: Int, minY: Double, maxY: Double) {
val actualRadius = radius val actualRadius = radius + 0.5
val segments = 32 val segments = 32
val step = (Math.PI * 2) / segments val step = (Math.PI * 2) / segments