距离计算
This commit is contained in:
@ -75,7 +75,7 @@ class MeasureSlopeDistance extends Measure {
|
||||
let l = this.clampPositions.length - 1
|
||||
this.clampPositions.forEach((item, index) => {
|
||||
if (index !== l) {
|
||||
let d1 = this.computeDistance([item.position, this.clampPositions[index + 1].position])
|
||||
let d1 = this.computeDistance2([item.position, this.clampPositions[index + 1].position])
|
||||
let d2 = Math.abs(item.position.alt - this.clampPositions[index + 1].position.alt)
|
||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||
total_length += d3
|
||||
@ -235,7 +235,7 @@ class MeasureSlopeDistance extends Measure {
|
||||
if (this.cachePositions.length) {
|
||||
let cur_point = this.cartesian3Towgs84(cartesian, this.viewer)
|
||||
let pre_p = this.cartesian3Towgs84(this.cachePositions[this.cachePositions.length - 1], this.viewer)
|
||||
let d1 = this.computeDistance([pre_p, cur_point])
|
||||
let d1 = this.computeDistance2([pre_p, cur_point])
|
||||
let d2 = Math.abs(pre_p.alt - cur_point.alt)
|
||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||
let cosAlpha = d1 / d3
|
||||
@ -276,7 +276,7 @@ class MeasureSlopeDistance extends Measure {
|
||||
}
|
||||
|
||||
computeAngle(start, end) {
|
||||
let d1 = this.computeDistance([start, end])
|
||||
let d1 = this.computeDistance2([start, end])
|
||||
let d2 = Math.abs(start.alt - end.alt)
|
||||
let d3 = Math.sqrt(d1 * d1 + d2 * d2)
|
||||
let cosAlpha = d1 / d3
|
||||
|
Reference in New Issue
Block a user