Replies: 1 comment 2 replies
-
import {WebMercatorViewport} from '@deck.gl/core';
import {lerp, distance} from 'gl-matrix/vec2';
const viewport = new WebMercatorViewport();
function paraboloid(source, target, ratio) {
const x = lerp([], source, target, ratio);
const center = lerp([], source, target, 0.5);
const dSourceCenter = distance(source, center);
const dXCenter = distance(x, center);
const h = (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);
return [x[0], x[1], h];
}
// ratio - a number between [0, 1]. 0 is the source, and 1 is the target.
function getPointAlongArc(sourceLngLat, targetLngLat, ratio) {
const source = viewport.projectPosition(sourceLngLat);
const target = viewport.projectPosition(targetLngLat);
const p = paraboloid(source, target, ratio);
return viewport.unprojectPosition(p);
}
// get center point
getPointAlongArc(from, to, 0.5); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is it possible to have a direction on the ArcLayer?
I can get the center of the 2 points from the data that I passed in and Add the IconLayer with the Arrow Icon. How do I place it on top of the Arc so it will be exactly on center of Arc?
Beta Was this translation helpful? Give feedback.
All reactions