Skip to content

Commit 3cad8ec

Browse files
visible arc when nodes are nearby
1 parent 99e11b9 commit 3cad8ec

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/lib/sphere.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ export function arcPoints(
2020
const start = latLngToVec3(sLat, sLng);
2121
const end = latLngToVec3(eLat, eLng);
2222
const dist = start.distanceTo(end);
23-
// Bow height grows with arc length but is clamped so long arcs hug the sphere
24-
// instead of flying far past its silhouette (and getting clipped by the canvas).
25-
const lift = GLOBE_RADIUS + Math.min(dist * 0.22, GLOBE_RADIUS * 0.35);
23+
// Bow height grows with arc length but is clamped on both ends: a minimum floor
24+
// keeps near-coincident endpoints from collapsing into a flat (invisible) arc,
25+
// and the max stops long arcs from flying past the silhouette and getting clipped.
26+
const MIN_BOW = GLOBE_RADIUS * 0.06;
27+
const MAX_BOW = GLOBE_RADIUS * 0.35;
28+
const lift = GLOBE_RADIUS + Math.min(Math.max(dist * 0.22, MIN_BOW), MAX_BOW);
2629
const pts: THREE.Vector3[] = [];
2730
for (let i = 0; i <= segments; i++) {
2831
const t = i / segments;

0 commit comments

Comments
 (0)