Adriaan van Natijne, October 2017.
Presented here is a abbriviated version of the manual presented in my Additional Thesis. Focus of this manual is to create a simple PoTree web-interface from a pointcloud and add radar measurements to it. This is not the full flowchart as discussed in the report. In this recipe a simple case of a single pointcloud and a small (less than 1500 points) radar file is discussed.
Using PoTreeConverter the input LAS-file is converted into an octree of binary files. For AHN3 tile 37EN1 the command will be as follows:
PotreeConverter C_37EN1.laz \ -o ./web --material INTENSITY -p AHN3 --show-skybox \ --projection "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs" \ --edl-enabled --intensity-range 3 256 -r 256 \ -a CLASSIFICATION INTENSITY
Some explanation on the parameters:
After running PoTreeConverter there should be a file web/AHN3.html. When opened in a browser (even locally) this should give a working PoTree installation.
Next step is adding the radar (error) ellipsoids. Independent of the source of the data JSON is the prefered format to feed the data to the viewer. In this recipe an extra simplified format is used. It may be extended at will.
As of Matlab 2016b jsonencode() is available. Other languages will have similar functions. The input does not matter as long as the output is of the same structure.
In this example the structure is a list of series of x, y, z values (as shown below) in the same coordinate system as the pointcloud. Whitespace is unimportant. The file should be saved as web/radar.json.
[{"x":85443.4,"y":446144.6,"z":-1.714},{"x":85452.0,"y":446150.5,"z":-1.346},{"x":85450.1,"y":446138.7,"z":-0.73},{"x":85437.0,"y":446151.9,"z":-0.7},{"x":85440.7,"y":446157.1,"z":-0.158},{"x":85434.1,"y":446142.3,"z":-0.569},{"x":85453.7,"y":446133.0,"z":-1.341},{"x":85458.1,"y":446135.6,"z":-1.543},{"x":85433.7,"y":446159.2,"z":-1.077},{"x":85435.6,"y":446161.7,"z":-0.8}]
To add the ellipsoids, add the following lines to web/AHN3.html, before </script> at around line 72. The current parameters (scaling, rotation) are based on the TerraSAR-X estimates. See the comments for some guidance.
// Read the file
$.getJSON('./radar.json', function(data) {
// Create a spehere with radius 1
let sph = new THREE.SphereGeometry(1, 12, 10);
// Create a material
let sphm = new THREE.MeshNormalMaterial();
// Create a rotation matrix
var eul = new THREE.Euler(0, -1.150172, -1.605703);
// Loop over all elements
$.each(data, function(key, val) {
// Create an element out of the sphere and the material
let s = new THREE.Mesh(sph, sphm);
// Scale the ellipsoid
s.scale.set(0.075, 0.025, 5.00);
// Rotate the ellipsoid
s.rotation.copy(eul);
// Position the ellipsoid
s.position.set(val.x, val.y, val.z);
// Calculate the transformation matrix ...
s.updateMatrix();
s.matrixAutoUpdate = false; // ... only once, to improve performence
// Add to the viewer (scene)
viewer.scene.scene.add(s);
});
});
You should now see ellipsoids in your 3D world (hint: on the pavement, they are small)!
Index - Last edited: 2017-10-26 16:30 CEST