| | |
| | | ); |
| | | const deltaDistance = (allDistance * passedSegmentCount) / totalSegmentCount; |
| | | const initPath = sprite.path; |
| | | const initMovePoint = G.snapToAnnulusOuterPath( |
| | | const initMovePoint = G.snapToAnnulusPath( |
| | | sprite.trackInfo, |
| | | sprite.x, |
| | | sprite.y, |
| | | initPath |
| | | ); |
| | | let mappingInfo = G.computeFinalPosition( |
| | | sprite.trackInfo, |
| | | initMovePoint, |
| | | let mappingInfo = G.getPositionAfterMove({ |
| | | point: initMovePoint, |
| | | pathList, |
| | | initPath, |
| | | path: initPath, |
| | | deltaDistance, |
| | | sprite.currentAngle |
| | | ); |
| | | angle: sprite.currentAngle |
| | | }); |
| | | sprite.x = mappingInfo.x; |
| | | sprite.y = mappingInfo.y; |
| | | sprite.path = mappingInfo.path; |
| | | sprite.rotation = G.getRotate(mappingInfo, mappingInfo.path) || sprite.rotation; |
| | | sprite.currentAngle = mappingInfo.angle; |
| | | sprite.mappingInfo = mappingInfo; |
| | | const anchorPoint = G.snapToAnnulusOuterPath( |
| | | const anchorPoint = G.snapToAnnulusPath( |
| | | sprite.trackInfo, |
| | | mappingInfo.x, |
| | | mappingInfo.y, |
| | |
| | | } else { |
| | | smoothDistance = stepCap; |
| | | } |
| | | const movePointBarcode = G.snapToAnnulusOuterPath( |
| | | const movePointBarcode = G.snapToAnnulusPath( |
| | | sprite.trackInfo, |
| | | sprite.x, |
| | | sprite.y, |
| | | path |
| | | ); |
| | | const angle = Math.atan2(sprite.y - path.y, sprite.x - path.x); |
| | | const p = G.computeFinalPosition( |
| | | sprite.trackInfo, |
| | | movePointBarcode, |
| | | const p = G.getPositionAfterMove({ |
| | | point: movePointBarcode, |
| | | pathList, |
| | | path, |
| | | smoothDistance, |
| | | deltaDistance: smoothDistance, |
| | | angle |
| | | ); |
| | | }); |
| | | sprite.path = p.path; |
| | | sprite.x = p.x; |
| | | sprite.y = p.y; |
| | |
| | | anchor.totalSegmentCount !== totalSegmentCount; |
| | | if (needResetAnchor) { |
| | | const anchorPath = sprite.path; |
| | | const anchorPoint = G.snapToAnnulusOuterPath( |
| | | const anchorPoint = G.snapToAnnulusPath( |
| | | sprite.trackInfo, |
| | | sprite.x, |
| | | sprite.y, |
| | |
| | | const deltaDistance = (allDistance * passedSegmentCount) / totalSegmentCount; |
| | | const path = anchor.path || sprite.path; |
| | | const barcodeMovePoint = { x: anchor.x, y: anchor.y }; |
| | | let finalPosition = G.computeFinalPosition( |
| | | sprite.trackInfo, |
| | | barcodeMovePoint, |
| | | let finalPosition = G.getPositionAfterMove({ |
| | | point: barcodeMovePoint, |
| | | pathList, |
| | | path, |
| | | deltaDistance, |
| | | anchor.angle |
| | | ); |
| | | angle: anchor.angle |
| | | }); |
| | | let curveDistance = G.calcDistance(sprite, finalPosition); |
| | | if (!isFinite(curveDistance)) { |
| | | curveDistance = deltaDistance; |
| | |
| | | typeof sprite.maV === 'number' && isFinite(sprite.maV) |
| | | ? sprite.maV * (1 - alpha) + v * alpha |
| | | : v; |
| | | } |
| | | if(device.index === 18) { |
| | | console.log("device",device,curveDistance,oldSprite.barcode, device.rgvPos,sprite.id) |
| | | } |
| | | if (curveDistance < EPSILON) { |
| | | this.finishDeviceMotion(sprite); |
| | |
| | | } |
| | | } |
| | | }); |
| | | |
| | | if (sprite.trackInfo.type === 'annulus' && minPath && x != null && y != null) { |
| | | const c = G.centerAnnulusBandPoint(sprite.trackInfo, x, y, minPath); |
| | | x = c.x; |
| | | y = c.y; |
| | | } |
| | | |
| | | return { x, y, angle, path: minPath }; |
| | | }, |