[orx-hash-grid] Replace Box3D with Box from org.openrndr.shape

This commit is contained in:
Edwin Jakobs
2025-01-24 18:18:13 +01:00
parent 969d342e91
commit 3442c95208
2 changed files with 6 additions and 16 deletions

View File

@@ -1,11 +0,0 @@
package org.openrndr.extra.hashgrid
import org.openrndr.math.Vector3
import kotlin.jvm.JvmRecord
@JvmRecord
data class Box3D(val corner: Vector3, val width: Double, val height: Double, val depth: Double) {
companion object {
val EMPTY = Box3D(Vector3.ZERO, 0.0, 0.0, 0.0)
}
}

View File

@@ -1,5 +1,6 @@
package org.openrndr.extra.hashgrid
import org.openrndr.math.Vector3
import org.openrndr.shape.Box
import kotlin.jvm.JvmRecord
import kotlin.math.abs
import kotlin.math.max
@@ -30,17 +31,17 @@ class Cell3D(val x: Int, val y: Int, val z: Int, val cellSize: Double) {
var zMax: Double = Double.NEGATIVE_INFINITY
private set
val bounds: Box3D
val bounds: Box
get() {
return Box3D(Vector3(x * cellSize, y * cellSize, z * cellSize), cellSize, cellSize, cellSize)
return Box(Vector3(x * cellSize, y * cellSize, z * cellSize), cellSize, cellSize, cellSize)
}
val contentBounds: Box3D
val contentBounds: Box
get() {
return if (points.isEmpty()) {
Box3D.EMPTY
Box.EMPTY
} else {
Box3D(Vector3(xMin, yMin, zMin), xMax - xMin, yMax - yMin, zMax - zMin)
Box(Vector3(xMin, yMin, zMin), xMax - xMin, yMax - yMin, zMax - zMin)
}
}