From 43e5d63f70fe4ca3d9a9496fc91fd3d91e9882fe Mon Sep 17 00:00:00 2001 From: Oscar Lorentzon Date: Fri, 8 Mar 2024 16:29:44 +0100 Subject: [PATCH] feat: add fisheye example Add example for heavily distorted fisheye. --- doc/src/js/utils/ChunkDataProvider.js | 11 +- examples/debug/fisheye.html | 200 ++++++++++++++++++++++++++ 2 files changed, 210 insertions(+), 1 deletion(-) create mode 100644 examples/debug/fisheye.html diff --git a/doc/src/js/utils/ChunkDataProvider.js b/doc/src/js/utils/ChunkDataProvider.js index 524248b5..0fa939ae 100644 --- a/doc/src/js/utils/ChunkDataProvider.js +++ b/doc/src/js/utils/ChunkDataProvider.js @@ -19,6 +19,10 @@ const IMAGE_TILES_Y = 10; export const REFERENCE = {alt: 0, lat: 0, lng: 0}; +function cloneMesh(mesh) { + return {faces: mesh.faces.slice(), vertices: mesh.vertices.slice()}; +} + export class ChunkDataProvider extends DataProviderBase { constructor() { super(new S2GeometryProvider()); @@ -27,6 +31,7 @@ export class ChunkDataProvider extends DataProviderBase { this.cells = new Map(); this.clusters = new Map(); this.images = new Map(); + this.mesh = {faces: [], vertices: []}; this.sequences = new Map(); } @@ -143,7 +148,7 @@ export class ChunkDataProvider extends DataProviderBase { // eslint-disable-next-line class-methods-use-this getMesh(_url) { - return Promise.resolve({faces: [], vertices: []}); + return Promise.resolve(cloneMesh(this.mesh)); } getSequence(sequenceId) { @@ -157,4 +162,8 @@ export class ChunkDataProvider extends DataProviderBase { getSpatialImages(imageIds) { return this.getImages(imageIds); } + + setMesh(mesh) { + this.mesh = mesh; + } } diff --git a/examples/debug/fisheye.html b/examples/debug/fisheye.html new file mode 100644 index 00000000..47be0f75 --- /dev/null +++ b/examples/debug/fisheye.html @@ -0,0 +1,200 @@ + + + + Fisheye + + + + + + + + + + + + +