Finish slicing box and UI

This commit is contained in:
Fuhrmann 2025-03-07 10:09:38 +01:00
parent 8227b4141a
commit 213537508c
19 changed files with 965 additions and 1361 deletions

View file

@ -1,5 +1,6 @@
import { Vector3 } from "three";
import { Extent } from "./build-scene";
import { unpackEdges, unpackVertices } from "./parsers";
export function getMaxSize(extent: Extent) {
return Math.max(
@ -32,3 +33,24 @@ export async function getMetadata(serviceUrl: string) {
throw new Error("HTTP error status: " + response.status);
}
}
export async function request(url: string) {
const response = await fetch(url);
if (response.ok) {
return response.arrayBuffer();
} else {
throw new Error("HTTP error status: " + response.status);
}
}
export async function fetchTriangleIndices(edgeUrl: string, geomId: string) {
const url = edgeUrl + geomId;
const buffer = await request(url);
return unpackEdges(buffer);
}
export async function fetchVertices(pointUrl: string, geomId: string) {
const url = pointUrl + geomId;
const buffer = await request(url);
return unpackVertices(buffer);
}