This commit is contained in:
2025-07-13 15:59:09 +02:00
parent f8c3f17ab9
commit 019ee166bd
6 changed files with 5063 additions and 33 deletions

View File

@@ -237,21 +237,21 @@ export default class VoxelSpaceBigInt {
// [1, 0, 0] [x] [ x]
// [0, 0, -1] * [y] = [-z]
// [0, 1, 0] [z] [ y]
private newIndexRotX(x: number, y: number, z: number) {
newIndexRotX(x: number, y: number, z: number) {
return this.dims[2] * this.dims[1] * x + this.dims[1] * (this.dims[2] - 1 - z) + y;
}
// [ 0, 0, 1] [x] [ z]
// [ 0, 1, 0] * [y] = [ y]
// [-1, 0, 0] [z] [-x]
private newIndexRotY(x: number, y: number, z: number) {
newIndexRotY(x: number, y: number, z: number) {
return this.dims[1] * this.dims[0] * z + this.dims[0] * y + (this.dims[0] - 1 - x);
}
// [0, -1, 0] [x] [-y]
// [1, 0, 0] * [y] = [ x]
// [0, 0, 1] [z] [ z]
private newIndexRotZ(x: number, y: number, z: number) {
newIndexRotZ(x: number, y: number, z: number) {
return this.dims[0] * this.dims[2] * (this.dims[1] - 1 - y) + this.dims[2] * x + z;
}
@@ -354,4 +354,4 @@ export default class VoxelSpaceBigInt {
}
return result;
}
}
}

19
src/solver/js/tests.ts Normal file
View File

@@ -0,0 +1,19 @@
import VoxelSpaceBoolean from "../../VoxelSpaceBoolean";
(function test1() {
const spaces = [ 23n, 30n, 15n, 43n, 172n, 92n, 11n ].map((space: bigint) => {
return new VoxelSpaceBoolean({
id: 1,
dims: [3, 3, 3],
space,
cullEmpty: true,
});
});
console.log(spaces[0].at(0, 0, 1));
console.log(spaces[0].at(1, 0, 0));
console.log(spaces[0].at(2, 1, 2));
console.log(spaces[0].at(1, 2, 1));
console.log(spaces[0].at(0, 0, 0));
console.log(spaces[0].at(2, 2, 1));
})();

17
src/tests.ts Normal file
View File

@@ -0,0 +1,17 @@
import VoxelSpaceBigInt from "./VoxelSpaceBigInt";
(function test1() {
const spaces = [ 23n, 30n, 15n, 43n, 172n, 92n, 11n ].map((space: bigint) => {
return new VoxelSpaceBigInt({
id: 1,
dims: [3, 3, 3],
space,
cullEmpty: false,
});
});
console.log(spaces[1].rotated90('x').getRaw());
console.log(spaces[1].rotated90('y').getRaw());
console.log(spaces[1].rotated90('z').getRaw());
})();