@kimap/indoor-positioning-sdk-vue2 5.9.7 → 5.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimap/indoor-positioning-sdk-vue2",
3
- "version": "5.9.7",
3
+ "version": "5.9.8",
4
4
  "description": "Vue2自包含室内定位SDK - 完全兼容Webpack3+Babel6 | Vue2 Self-Contained Indoor Positioning SDK",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -133,12 +133,29 @@ SceneCore.prototype.setCameraPosition = function() {
133
133
  var origin = this.coordinateSystem.origin;
134
134
  var maxX = this.coordinateSystem.maxX;
135
135
  var maxY = this.coordinateSystem.maxY;
136
-
136
+
137
137
  var centerX = origin.x + maxX / 2;
138
138
  var centerZ = origin.z;
139
- var distance = Math.max(maxX, maxY) * 1.5;
140
-
141
- this.camera.position.set(centerX, distance, centerZ + distance * 0.5);
139
+ var maxSize = Math.max(maxX, maxY);
140
+
141
+ // 单模型默认相机参数:俯仰角47.52°,方位角-37.94°,基准距离11.49
142
+ var pitchDeg = 47.52;
143
+ var azimuthDeg = -37.94;
144
+ var baseDistance = 11.49;
145
+ var distance = maxSize > 0 ? (baseDistance / 10) * maxSize : baseDistance;
146
+
147
+ var pitchRad = pitchDeg * Math.PI / 180;
148
+ var azimuthRad = azimuthDeg * Math.PI / 180;
149
+ var cosPitch = Math.cos(pitchRad);
150
+ var sinPitch = Math.sin(pitchRad);
151
+ var cosAzimuth = Math.cos(azimuthRad);
152
+ var sinAzimuth = Math.sin(azimuthRad);
153
+
154
+ this.camera.position.set(
155
+ centerX + distance * sinAzimuth * cosPitch,
156
+ distance * sinPitch,
157
+ centerZ + distance * cosAzimuth * cosPitch
158
+ );
142
159
  this.camera.lookAt(centerX, 0, centerZ);
143
160
  };
144
161
 
@@ -488,9 +505,25 @@ SceneCore.prototype._adjustCameraToAllFloors = function() {
488
505
  box.getCenter(center);
489
506
  box.getSize(size);
490
507
  var maxSize = Math.max(size.x, size.z);
491
- var distance = maxSize * 2;
492
508
 
493
- this.camera.position.set(center.x, center.y + distance * 1.5, center.z + distance);
509
+ // ALL多模型相机参数:俯仰角61.19°,方位角-47.86°,基准距离12.21
510
+ var pitchDeg = 61.19;
511
+ var azimuthDeg = -47.86;
512
+ var baseDistance = 12.21;
513
+ var distance = maxSize > 0 ? (baseDistance / 10) * maxSize : baseDistance;
514
+
515
+ var pitchRad = pitchDeg * Math.PI / 180;
516
+ var azimuthRad = azimuthDeg * Math.PI / 180;
517
+ var cosPitch = Math.cos(pitchRad);
518
+ var sinPitch = Math.sin(pitchRad);
519
+ var cosAzimuth = Math.cos(azimuthRad);
520
+ var sinAzimuth = Math.sin(azimuthRad);
521
+
522
+ this.camera.position.set(
523
+ center.x + distance * sinAzimuth * cosPitch,
524
+ center.y + distance * sinPitch,
525
+ center.z + distance * cosAzimuth * cosPitch
526
+ );
494
527
  this.camera.lookAt(center);
495
528
  if (this.controls) {
496
529
  this.controls.target.copy(center);
@@ -527,10 +560,25 @@ SceneCore.prototype.adjustCameraToFloor = function(floorIndex) {
527
560
  box.getCenter(center);
528
561
  box.getSize(size);
529
562
  var maxSize = Math.max(size.x, size.z);
530
- var distance = maxSize * 1.5;
531
563
 
532
- // -60° 俯角(与 ALL -45° 区分,单楼层更俯视)
533
- this.camera.position.set(center.x, center.y - distance * 1.732, center.z + distance);
564
+ // 单模型相机参数:俯仰角47.52°,方位角-37.94°,基准距离11.49
565
+ var pitchDeg = 47.52;
566
+ var azimuthDeg = -37.94;
567
+ var baseDistance = 11.49;
568
+ var distance = maxSize > 0 ? (baseDistance / 10) * maxSize : baseDistance;
569
+
570
+ var pitchRad = pitchDeg * Math.PI / 180;
571
+ var azimuthRad = azimuthDeg * Math.PI / 180;
572
+ var cosPitch = Math.cos(pitchRad);
573
+ var sinPitch = Math.sin(pitchRad);
574
+ var cosAzimuth = Math.cos(azimuthRad);
575
+ var sinAzimuth = Math.sin(azimuthRad);
576
+
577
+ this.camera.position.set(
578
+ center.x + distance * sinAzimuth * cosPitch,
579
+ center.y + distance * sinPitch,
580
+ center.z + distance * cosAzimuth * cosPitch
581
+ );
534
582
  var lookAtTgt = new THREE.Vector3(center.x, center.y, center.z);
535
583
  this.camera.lookAt(lookAtTgt);
536
584
  if (this.controls) {
@@ -919,7 +967,7 @@ SceneCore.prototype._processMaterial = function(child, materials, colorMap) {
919
967
  */
920
968
  SceneCore.prototype._adjustCameraToModel = function() {
921
969
  var self = this;
922
-
970
+
923
971
  try {
924
972
  var finalBox = new THREE.Box3().setFromObject(self.mapModel);
925
973
  var finalCenter = new THREE.Vector3();
@@ -929,12 +977,23 @@ SceneCore.prototype._adjustCameraToModel = function() {
929
977
  finalBox.getSize(finalSize);
930
978
  var maxSize = Math.max(finalSize.x, finalSize.z);
931
979
 
932
- var distance = maxSize * 1.5;
980
+ // 单模型相机参数:俯仰角47.52°,方位角-37.94°,基准距离11.49
981
+ var pitchDeg = 47.52;
982
+ var azimuthDeg = -37.94;
983
+ var baseDistance = 11.49;
984
+ var distance = maxSize > 0 ? (baseDistance / 10) * maxSize : baseDistance;
985
+
986
+ var pitchRad = pitchDeg * Math.PI / 180;
987
+ var azimuthRad = azimuthDeg * Math.PI / 180;
988
+ var cosPitch = Math.cos(pitchRad);
989
+ var sinPitch = Math.sin(pitchRad);
990
+ var cosAzimuth = Math.cos(azimuthRad);
991
+ var sinAzimuth = Math.sin(azimuthRad);
933
992
 
934
993
  self.camera.position.set(
935
- finalCenter.x,
936
- finalCenter.y + distance,
937
- finalCenter.z + distance * 0.5
994
+ finalCenter.x + distance * sinAzimuth * cosPitch,
995
+ finalCenter.y + distance * sinPitch,
996
+ finalCenter.z + distance * cosAzimuth * cosPitch
938
997
  );
939
998
  self.camera.lookAt(finalCenter.x, finalCenter.y, finalCenter.z);
940
999