|
|
@@ -374,20 +374,27 @@ export class Path extends ctrlPolygon{
|
|
|
|
|
|
|
|
|
getPosByIntersect(e, type){//intersect落在线上的位置,以及在哪两个点之间
|
|
|
-
|
|
|
+ let modelMatrixInvert = this.edge.matrixWorld.clone().invert()
|
|
|
+
|
|
|
if( !Potree.settings.pathSmooth ){
|
|
|
let prevIndex = Math.floor(e.hoveredElement.faceIndex / 2) //端点1(可能是最后一个)
|
|
|
let nextIndex = this.getIndex(prevIndex, 1) //端点2(可能是第一个)
|
|
|
let index = prevIndex + 1 //新点在端点1后
|
|
|
let point = math.getFootPoint(e.hoveredElement.point, this.points[prevIndex], this.points[nextIndex] );
|
|
|
+
|
|
|
return {index, prevIndex, point }
|
|
|
}else{
|
|
|
-
|
|
|
+ let hoverAtGeo = e.hoveredElement.point.clone().applyMatrix4(modelMatrixInvert)
|
|
|
let prevIndex0 = Math.floor(e.hoveredElement.faceIndex / 2) //所在的mesh片段的端点1
|
|
|
let nextIndex0 = prevIndex0 + 1 //所在的mesh片段的端点2
|
|
|
+
|
|
|
+ let point = math.getFootPoint(hoverAtGeo, this.geoPoints[prevIndex0], this.geoPoints[nextIndex0] ); //新点位置
|
|
|
+ //console.log('point',point)
|
|
|
|
|
|
- let point = math.getFootPoint(e.hoveredElement.point, this.geoPoints[prevIndex0], this.geoPoints[nextIndex0] ); //新点位置
|
|
|
- if(type == 'onlyPoint')return {point}
|
|
|
+ if(type == 'onlyPoint'){
|
|
|
+ point.applyMatrix4(this.edge.matrixWorld)
|
|
|
+ return {point}
|
|
|
+ }
|
|
|
|
|
|
let prevIndex,nextIndex
|
|
|
let count = this.points.length - 1
|
|
|
@@ -428,6 +435,8 @@ export class Path extends ctrlPolygon{
|
|
|
nextIndex = prevIndex + 1
|
|
|
//console.log(prevIndex, nextIndex)
|
|
|
let index = prevIndex + 1 //新点在端点1后
|
|
|
+
|
|
|
+ point.applyMatrix4(this.edge.matrixWorld)
|
|
|
return {index, prevIndex, point }
|
|
|
}
|
|
|
}//如果后续还出现index错误的问题,可以改为绘制时用折线,完成后用曲线。
|