
npm install and npm run build.const scene = new Scene();
const camera = new PerspectiveCamera(60, 1, 0.1, 10000);
const canvas = document.getElementById("canvas");
const renderer = new WebGLRenderer({canvas:canvas});
const geometry = new BoxGeometry(1, 1, 1);
const material = new MeshBasicMaterial({color: 0x00ff00});
const cube = new Mesh(geometry, material);
scene.add(cube);
const controls = new OrbitControls(camera, canvas);
camera.position.z = 10;
const pointClouds = [];
const baseUrl = "data/test/";
const potree = new Potree();
potree.loadPointCloud("cloud.js", url => `${baseUrl}${url}`,).then(function(pco) {
scene.add(pco);
pointClouds.push(pco);
});
function loop()
{
potree.updatePointClouds(pointClouds, camera, renderer);
controls.update();
renderer.render(scene, camera);
requestAnimationFrame(loop);
};
loop();
createClipBox(size, position) helper to build an IClipBox from a size and world-space position.ClipMode on the material and pass the clip boxes to setClipBoxes().import { ClipMode, createClipBox } from 'potree-core';
import { Vector3 } from 'three';
// Create a 5×5×5 clip box centered at world position (2, 0, 0)
const clipBox = createClipBox(new Vector3(5, 5, 5), new Vector3(2, 0, 0));
// Highlight points inside the box (other modes: CLIP_OUTSIDE, CLIP_INSIDE, DISABLED)
pco.material.clipMode = ClipMode.HIGHLIGHT_INSIDE;
pco.material.setClipBoxes([clipBox]);
ClipMode.DISABLED – no clipping.ClipMode.CLIP_OUTSIDE – only points inside the box are rendered.ClipMode.CLIP_INSIDE – only points outside the box are rendered.ClipMode.HIGHLIGHT_INSIDE – all points rendered; points inside the box are highlighted.createClipSphere(center, radius) helper to build an IClipSphere from a center position and radius.ClipMode on the material and pass the clip spheres to setClipSpheres().import { ClipMode, createClipSphere } from 'potree-core';
import { Vector3 } from 'three';
// Create a sphere of radius 3 centered at world position (0, 1, 0)
const clipSphere = createClipSphere(new Vector3(0, 1, 0), 3);
// Highlight points inside the sphere (other modes: CLIP_OUTSIDE, CLIP_INSIDE, DISABLED)
pco.material.clipMode = ClipMode.HIGHLIGHT_INSIDE;
pco.material.setClipSpheres([clipSphere]);
ClipMode.DISABLED – no clipping.ClipMode.CLIP_OUTSIDE – only points inside the sphere are rendered.ClipMode.CLIP_INSIDE – only points outside the sphere are rendered.ClipMode.HIGHLIGHT_INSIDE – all points rendered; points inside the sphere are highlighted. class CustomRequestManager implements RequestManager
{
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response> {
throw new Error("Method not implemented.")
}
async getUrl(url: string): Promise<string> {
return url;
}
}
.\PotreeConverter '..\input.laz' -o ../output.\txt2las64 -i input.pts -ipts -parse xyziRGB -set_scale 0.001 0.001 0.001 -set_version 1.4 -o output.laz### To Do