|
@@ -1,8 +1,16 @@
|
|
|
-datasets中的orientation为模型整体绕z轴的旋转角度,初始为0
|
|
|
+dataset里用的boundingbox是cloud里的tightBoundingBox
|
|
|
+///site_model包含数据集信息
|
|
|
+///datasets中的orientation为模型整体绕z轴的旋转角度,初始为0
|
|
|
|
|
|
+ 组织形式:
|
|
|
+ 数据集
|
|
|
+ -建筑物
|
|
|
+ -楼层
|
|
|
+ -房间 或 地点:
|
|
|
|
|
|
-filter中的:
|
|
|
|
|
|
+
|
|
|
+///filter中的:
|
|
|
|
|
|
|
|
|
数据集校准后不变的值有:
|
|
@@ -25,22 +33,29 @@ floor_location
|
|
|
var view = window.IV.getMainView()
|
|
|
view.currentImage.id
|
|
|
view.ImageService.images
|
|
|
+view.DatasetRepository.dataMap
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+分屏
|
|
|
+enableSplitScreen
|
|
|
|
|
|
|
|
|
POI: 兴趣点 PoiService PoiEditorDirective PoiEntity
|
|
|
t.prototype.isPreviewMenuVisible ---- canDisplayResultDetails --- PoiService.openedPoi - setOpenedPoi
|
|
|
|
|
|
-MeasurementLineMaterial : 测量线材质, 有蓝色标准实线和灰色透明虚线两种状态
|
|
|
+MeasurementLineMaterial : 测量线材质, 有蓝色标准实线和灰色透明虚线两种状态 depthTexture见renderOffscreen
|
|
|
|
|
|
|
|
|
-数据集校准 saveAlignment = selectedDatasets
|
|
|
+数据集校准 saveAlignment = selectedDatasets m2w_保存了数据集的变换
|
|
|
|
|
|
this.underlayScene.children[3] 包含32个子mesh, 是全景图sphere 其材质fragment在下方
|
|
|
overlayScene 里有marker , name: "location" ?
|
|
|
+点云: this.scene.children里找到最后一个, name: "PointCloudLayer"
|
|
|
+
|
|
|
+LocationEntity点位?GeoTransformationService: this.TransformService.globalToLocal.transform 转换坐标 setLocalCoordinateSystem
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
QuaternionFactory VectorFactory
|
|
|
|
|
@@ -84,9 +99,68 @@ var getSize = function(imgWidth, scale){//imgWidth:图片宽度, scale缩放
|
|
|
//另:可能不是*2.5, 也许是*256/100 ? 不知道如何精确测试下
|
|
|
//有出现过一次错误是2048时的图但是大了一倍,发现是传图的那个网页在缩放值为0.1(即图为1:1显示,函数canvasFunction(extent, scale )时只有1024大小,后来刷新重新操作就是2048然后就正确。所以可能是这个网页出错。
|
|
|
}
|
|
|
+
|
|
|
+//换成算法部给的图后改成:
|
|
|
+var getSize = function(imgWidth, scale){//imgWidth:图片宽度 假设是正方形
|
|
|
+ return imgWidth * 0.05; //因为图是1px = 0.05米
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
//位置直接使用中心点的经纬度
|
|
|
//-------------------------------------------------
|
|
|
+decodeBitStream 解析quadtree字符串
|
|
|
+输入 "fccf7fffcff3bf7f"
|
|
|
+输出
|
|
|
+0: {2: {…}, 3: {…}}
|
|
|
+1: {2: {…}, 3: {…}}
|
|
|
+2: {0: {…}, 1: {…}, 2: {…}, 3: {…}}
|
|
|
+3: {0: {…}, 1: {…}, 2: {…}}
|
|
|
+
|
|
|
+代表含义:
|
|
|
+最外层0123代表第一层能分裂出四块,分别为左上、右上、左下、右下; 子层中的0 又能分裂出四块,但它只包含2和3这两块,也就是左下和右下。以此类推。
|
|
|
+
|
|
|
+
|
|
|
+解析规则
|
|
|
+
|
|
|
+依次取出每个字母,字母代表的是16进制的数字(假设为o),代表的意思是它的子项中是否包含1或2或3或4(如第一行的0只包含了2和3),计算方式是
|
|
|
+与运算,如 1 & o 为true 则包含1, 2 & o 为true 则包含2...
|
|
|
+
|
|
|
+该案例中"fccf7fffcff3bf7f" 共有16个字母,分别为最外层1个加第二层4个加第三层11个
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+代码:
|
|
|
+e.decodeBitStream = function(t) {
|
|
|
+ for (var e = {}, n = [e], i = 0; i < t.length; i++) {
|
|
|
+ var r = n.shift()//取出一个字母转为数字
|
|
|
+ , o = parseInt(t.substr(i, 1), 16);
|
|
|
+ //开始解析数字含义:
|
|
|
+ if (1 & o) {
|
|
|
+ var a = {};//标记
|
|
|
+ r[0] = a,
|
|
|
+ n.push(a)
|
|
|
+ }
|
|
|
+ if (2 & o) {
|
|
|
+ a = {};
|
|
|
+ r[1] = a,
|
|
|
+ n.push(a)
|
|
|
+ }
|
|
|
+ if (4 & o) {
|
|
|
+ a = {};
|
|
|
+ r[2] = a,
|
|
|
+ n.push(a)
|
|
|
+ }
|
|
|
+ if (8 & o) {
|
|
|
+ a = {};
|
|
|
+ r[3] = a,
|
|
|
+ n.push(a)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
+
|
|
|
+现在需要一个反向的算法,已知quadTree(根据图片)求字符串
|
|
|
=======shader=======
|
|
|
全景图 fragment
|
|
|
|
|
@@ -331,7 +405,7 @@ void main()
|
|
|
|
|
|
// <-- end of copied code
|
|
|
|
|
|
-#ifdef GL_EXT_frag_depth
|
|
|
+#ifdef GL_EXT_frag_depth
|
|
|
// mixFactor and clipFactor define the color mixing proportion between the states of
|
|
|
// full visibility and occluded visibility
|
|
|
// and
|
|
@@ -380,3 +454,121 @@ void main()
|
|
|
gl_FragColor.a *= (1.0 - clipFactor);
|
|
|
}
|
|
|
|
|
|
+/////////////////////////////////////
|
|
|
+
|
|
|
+参考applyRotationToDataset 、 applyTranslationToDataset
|
|
|
+
|
|
|
+已知
|
|
|
+oldOrientation、oldLocation
|
|
|
+newOrientation、newLocation
|
|
|
+
|
|
|
+
|
|
|
+var getTransfromMatrix = function(orientation, location){ //参数分别是旋转角度和平移向量
|
|
|
+ var a1 = Math.cos(orientation), a2 = Math.sin(orientation);
|
|
|
+
|
|
|
+ var mat = new THREE.Matrix4();
|
|
|
+ mat.elements[0] = a1,
|
|
|
+ mat.elements[1] = a2,
|
|
|
+ mat.elements[4] = -a2,
|
|
|
+ mat.elements[5] = a1
|
|
|
+
|
|
|
+
|
|
|
+ mat.elements[12] = location.x;
|
|
|
+ mat.elements[13] = location.y;
|
|
|
+ mat.elements[14] = location.z;
|
|
|
+ return mat
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+var oldMatrix = getTransfromMatrix(oldOrientation, oldLocation)
|
|
|
+var newMatrix = getTransfromMatrix(newOrientation, newLocation)
|
|
|
+
|
|
|
+var oldMatrixInverse = new THREE.Matrix4().getInverse(oldMatrix)
|
|
|
+var diffMatrix = new THREE.Matrix4().multiplyMatrices(oldMatrixInverse, newMatrix)//和上一次变换的差 矩阵
|
|
|
+
|
|
|
+var newPoint = oldPoint.applyMatrix4(diffMatrix) //修改棋盘每个顶点
|
|
|
+//如果是基于初始的棋盘来修改,去掉oldMatrix、 diffMatrix 直接根据newMatrix修改oldPoint
|
|
|
+
|
|
|
+
|
|
|
+============
|
|
|
+数据集初始化校准
|
|
|
+var fakePositions = [ {
|
|
|
+ x: -1.208132028579712,
|
|
|
+ y: 0.04820600152015686,
|
|
|
+ z: -2.257599115371704,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ x: 1.6327489614486694,
|
|
|
+ y: 0.056550998240709305,
|
|
|
+ z: -2.1368539333343506,
|
|
|
+ },{
|
|
|
+ x: 0.05691400170326233,
|
|
|
+ y: 0.04810800030827522,
|
|
|
+ z: 0.97919100522995,
|
|
|
+ },{
|
|
|
+ x: -0.5570799708366394,
|
|
|
+ y: 0.04639599844813347,
|
|
|
+ z: 3.0515389442443848 ,
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
+
|
|
|
+var realPositions = [
|
|
|
+ { x: 458249.577950831, y: 2474529.667443291 },
|
|
|
+ { x: 458247.51758545433, y: 2474531.6324389814 },
|
|
|
+ {x: 458250.7569026919, y: 2474532.9341176464 },
|
|
|
+ {x: 458252.6196984933, y: 2474534.0980041157 }
|
|
|
+ ]//正确点位的点位
|
|
|
+
|
|
|
+fakePositions = fakePositions.map(e=>{
|
|
|
+ return new THREE.Vector3(e.x, -e.z, 0);
|
|
|
+})
|
|
|
+realPositions = realPositions.map(e=>{
|
|
|
+ return new THREE.Vector3(e.x, e.y, 0);
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+var moveVec = new THREE.Vector3().subVectors(realPositions[0], fakePositions[0]) //平移向量
|
|
|
+
|
|
|
+var vec1 = new THREE.Vector3().subVectors(fakePositions[0], fakePositions[1]) //旧的向量
|
|
|
+var vec2 = new THREE.Vector3().subVectors(realPositions[0], realPositions[1])//新的向量
|
|
|
+var angle = vec1.angleTo(vec2)
|
|
|
+if(vec1.clone().cross(vec2).z < 0)angle *= -1 //这里不确定是<0还是>0
|
|
|
+
|
|
|
+var matrix = new THREE.Matrix4().setPosition(moveVec.clone().sub(realPositions[0]))
|
|
|
+var rotateMatrix = new THREE.Matrix4().makeRotationAxis(new THREE.Vector3(0,0,1), angle );
|
|
|
+matrix.premultiply(rotateMatrix)
|
|
|
+var moveBackMatrix = new THREE.Matrix4().setPosition(realPositions[0])
|
|
|
+matrix.premultiply(moveBackMatrix)
|
|
|
+
|
|
|
+
|
|
|
+var pos = fakePositions.map(e=>{
|
|
|
+ return e.clone().applyMatrix4(matrix)
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+==========
|
|
|
+4dkk根据给的经纬度控制点转化,filter orientation取值
|
|
|
+
|
|
|
+var rot90 = (new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,0,1), THREE.Math.degToRad(-90))
|
|
|
+var rot90Invert = rot90.clone().inverse()
|
|
|
+
|
|
|
+a.forEach(e=>{
|
|
|
+ var t = e.dataset_orientation
|
|
|
+ var u = new THREE.Quaternion(t[1],t[2],t[3],t[0]).multiply(rot90);
|
|
|
+ var ee = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0,0,1), 2.4223594240392305 );
|
|
|
+ u.multiply(ee)
|
|
|
+
|
|
|
+
|
|
|
+ var u1 = u.clone().multiply(rot90Invert);
|
|
|
+ var e2 = u1.toArray();
|
|
|
+ e.orientation = [e2[3], e2[0], e2[1], e2[2]]
|
|
|
+
|
|
|
+})
|
|
|
+
|
|
|
+注意:现在的经纬度和四维看看中的不一定对得准,存在误差,可能主要问题出再算出的位移、漫游点的dataset本地坐标上
|
|
|
+
|
|
|
+
|
|
|
+
|