fixed height profile cut plane with markers at different heights. Cut plane must be aligned orthogonal to ground, i.e ignore height differences
This commit is contained in:
parent
325c62f890
commit
620277ab29
@ -11,13 +11,16 @@ Potree.ProfileData = function(profile){
|
||||
var start = profile.points[i];
|
||||
var end = profile.points[i+1];
|
||||
|
||||
var center = new THREE.Vector3().addVectors(end, start).multiplyScalar(0.5);
|
||||
var length = new THREE.Vector3(start.x, 0, start.z).distanceTo(new THREE.Vector3(end.x, 0, end.z));
|
||||
var side = new THREE.Vector3().subVectors(end, start).normalize();
|
||||
var startGround = new THREE.Vector3(start.x, 0, start.z);
|
||||
var endGround = new THREE.Vector3(end.x, 0, end.z);
|
||||
|
||||
var center = new THREE.Vector3().addVectors(endGround, startGround).multiplyScalar(0.5);
|
||||
var length = startGround.distanceTo(endGround);
|
||||
var side = new THREE.Vector3().subVectors(endGround, startGround).normalize();
|
||||
var up = new THREE.Vector3(0, 1, 0);
|
||||
var forward = new THREE.Vector3().crossVectors(side, up).normalize();
|
||||
var N = forward;
|
||||
var cutPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(N, start);
|
||||
var cutPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(N, startGround);
|
||||
var halfPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(side, center);
|
||||
|
||||
var project = function(_start, _end, _mileage){
|
||||
@ -62,7 +65,7 @@ Potree.ProfileData = function(profile){
|
||||
|
||||
this.segments.push(segment);
|
||||
|
||||
mileage.x += new THREE.Vector3(start.x, 0, start.z).distanceTo(new THREE.Vector3(end.x, 0, end.z));
|
||||
mileage.x += length;
|
||||
mileage.y += end.y - start.y;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user