@mark1russell7/visuals 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/build/{extent-CALhBZU-.js → extent-DC0qrxC5.js} +48 -25
- package/build/extent-DC0qrxC5.js.map +1 -0
- package/build/globe.d.ts +3 -2
- package/build/globe.d.ts.map +1 -1
- package/build/globe.js +2 -1
- package/build/globe.js.map +1 -1
- package/build/index.d.ts +19 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +26 -3
- package/build/index.js.map +1 -0
- package/build/labels.d.ts +1 -1
- package/build/{motion-0tsT6sY4.js → motion-dvvkaDwv.js} +9 -6
- package/build/motion-dvvkaDwv.js.map +1 -0
- package/build/{stage-CtWLSoV-.d.ts → stage-Bhu1f7Dw.d.ts} +3 -5
- package/build/{stage-CtWLSoV-.d.ts.map → stage-Bhu1f7Dw.d.ts.map} +1 -1
- package/build/{theme-CKXd_emk.d.ts → theme-3EGbXXoP.d.ts} +20 -4
- package/build/theme-3EGbXXoP.d.ts.map +1 -0
- package/build/three.d.ts +2 -2
- package/build/three.js +16 -10
- package/build/three.js.map +1 -1
- package/package.json +1 -1
- package/build/extent-CALhBZU-.js.map +0 -1
- package/build/motion-0tsT6sY4.js.map +0 -1
- package/build/theme-CKXd_emk.d.ts.map +0 -1
package/build/globe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globe.js","names":["RADIANS"],"sources":["../src/globe/mesh.ts","../src/globe/space.ts","../src/globe/content.ts"],"sourcesContent":["import { densify, type Position, type Region } from \"@mark1russell7/geo\";\nimport { ShapeUtils, Vector2 } from \"three\";\n\n/**\n * The surface of a region as triangles. The region and the triangles are in the plane of longitude and latitude,\n * as the polygon tests of `@mark1russell7/geo` are. So a triangle does not go across the antimeridian.\n */\nexport interface RegionSurface {\n /** The longitude and the latitude of each corner, in degrees: two numbers for each corner. */\n readonly corners: Float64Array;\n /** The three corners of each triangle, as indices of corners. Each triangle is counterclockwise in the plane, with east on the right and north up. */\n readonly triangles: Uint32Array;\n}\n\n/** The largest count of corners of the surface of one region. A smaller step gives more corners. */\nexport const MAX_SURFACE_CORNERS = 2_000_000;\n\n/**\n * The longest edge in a surface, as a factor of the step. An edge of the outline is not longer than the step.\n * An edge in the surface can be longer by this factor, so the count of the passes has a small limit.\n */\nconst LONG_EDGE = 1.25;\n\n/**\n * The smallest length of a degree of longitude in the size of an edge, as a part of a degree at the equator.\n * Near a pole, a degree of longitude is short, and an edge can go across many of them. This limit keeps such an edge to 5 steps of longitude.\n * A straight edge on the Earth is not a straight line in longitude and latitude. The two are far apart for an edge across many degrees.\n */\nconst MIN_WIDTH = 0.25;\n\n/** The largest count of passes that divide the long edges. Each pass makes the longest edge shorter by almost a half. */\nconst MAX_PASSES = 48;\n\n/** The factor of the first corner in the key of an edge. A key is an exact integer for each pair of corners below this count. */\nconst KEY = 2 ** 26;\n\n/** The largest distance of a corner from an edge that it is on, as a part of the length of the edge. */\nconst ON_EDGE = 1e-12;\n\n/** The largest distance of a longitude from 180 degrees, or of a latitude from 90 degrees, that is on the antimeridian or on a pole. */\nconst ON_LINE = 1e-9;\n\nconst RADIANS = Math.PI / 180;\n\n/** This function gives one number of a list. The index is always in the list, so the default 0 has no use. */\nfunction at(list: ArrayLike<number>, index: number): number {\n return list[index] ?? 0;\n}\n\nfunction edgeKey(a: number, b: number): number {\n return a < b ? a * KEY + b : b * KEY + a;\n}\n\n/**\n * This function gives the height of the flat triangles of a surface below a ball of radius 1, at most.\n * A layer at this height above a ball does not go into the ball. `step` is the step of the surface, in degrees.\n */\nexport function surfaceSag(step: number): number {\n // A triangle with no edge longer than `a` on a ball is below the ball by 1 - cos(a / sqrt 3) at most.\n // An edge with a step of `s` in longitude and in latitude has the length s * sqrt 2 at most.\n return 1 - Math.cos((step * RADIANS * LONG_EDGE * Math.SQRT2) / Math.sqrt(3));\n}\n\n/** This function gives the points of a ring, each one time. A point is different from the point before it, and the last point is different from the first point. */\nfunction openRing(ring: readonly Position[]): Vector2[] {\n const points: Vector2[] = [];\n for (const position of ring) {\n const last = points[points.length - 1];\n if (last === undefined || last.x !== position[0] || last.y !== position[1]) points.push(new Vector2(position[0], position[1]));\n }\n const first = points[0];\n while (points.length > 1 && first !== undefined && points[points.length - 1]?.equals(first) === true) points.pop();\n return points;\n}\n\n/**\n * This function gives the size of an edge for the division of a surface, in degrees. The size is the larger of its steps in latitude and in longitude.\n * A step of longitude is as long as it is on the Earth, at the end of the edge that is nearer to the equator.\n */\nfunction edgeSize(lon: readonly number[], lat: readonly number[], a: number, b: number): number {\n const latA = at(lat, a);\n const latB = at(lat, b);\n const wide = Math.abs(at(lon, a) - at(lon, b)) * Math.max(Math.cos(Math.min(Math.abs(latA), Math.abs(latB)) * RADIANS), MIN_WIDTH);\n return Math.max(Math.abs(latA - latB), wide);\n}\n\n/** This function gives, for each edge of a list of faces, a face that has it. An edge of an outline has only one face. */\nfunction ownersOf(faces: readonly (readonly number[])[]): Map<number, number> {\n const owner = new Map<number, number>();\n faces.forEach((face, index) => {\n for (let side = 0; side < face.length; side++) owner.set(edgeKey(at(face, side), at(face, (side + 1) % face.length)), index);\n });\n return owner;\n}\n\n/**\n * This function divides the face with the edge from `a` to `b` at each corner of `run`. The corners of `run` are on the edge, in the sequence from `a` to `b`.\n * Each new face has the third corner of the face, and the direction of the face. An edge with no face changes nothing.\n */\nfunction divideAt(faces: number[][], owner: Map<number, number>, a: number, b: number, run: readonly number[]): void {\n const index = owner.get(edgeKey(a, b));\n const face = index === undefined ? undefined : faces[index];\n const c = face?.find((corner) => corner !== a && corner !== b);\n if (index === undefined || face === undefined || c === undefined || run.length === 0) return;\n const forward = face[(face.indexOf(a) + 1) % 3] === b;\n const chain = [a, ...run, b];\n for (let piece = 0; piece + 1 < chain.length; piece++) {\n const from = at(chain, piece);\n const to = at(chain, piece + 1);\n const place = piece === 0 ? index : faces.length;\n faces[place] = forward ? [from, to, c] : [to, from, c];\n owner.set(edgeKey(from, to), place);\n if (piece === 0) owner.set(edgeKey(a, c), place);\n if (piece === chain.length - 2) owner.set(edgeKey(b, c), place);\n }\n}\n\n/**\n * This function gives the corners that are on the edge from `u` to `v`, between its ends, in the sequence from `u` to `v`.\n * `byLon` has each corner, from the smallest longitude to the largest.\n */\nfunction cornersOn(points: readonly Vector2[], byLon: readonly number[], u: number, v: number): number[] {\n const from = points[u];\n const to = points[v];\n if (from === undefined || to === undefined) return [];\n const dx = to.x - from.x;\n const dy = to.y - from.y;\n const square = dx * dx + dy * dy;\n if (!(square > 0)) return [];\n const slack = Math.sqrt(square) * ON_EDGE;\n const low = Math.min(from.x, to.x) - slack;\n const high = Math.max(from.x, to.x) + slack;\n let first = 0;\n let end = byLon.length;\n while (first < end) {\n const middle = (first + end) >> 1;\n if ((points[at(byLon, middle)]?.x ?? Infinity) < low) first = middle + 1;\n else end = middle;\n }\n const found: { readonly corner: number; readonly part: number }[] = [];\n for (let index = first; index < byLon.length; index++) {\n const corner = at(byLon, index);\n const point = points[corner];\n if (point === undefined || point.x > high) break;\n if (corner === u || corner === v) continue;\n const px = point.x - from.x;\n const py = point.y - from.y;\n const part = (px * dx + py * dy) / square;\n if (part > 0 && part < 1 && Math.abs(px * dy - py * dx) <= square * ON_EDGE) found.push({ corner, part });\n }\n return found.sort((one, other) => one.part - other.part).map(({ corner }) => corner);\n}\n\n/**\n * This function divides a polygon into triangles. Each ring has no point two times in sequence. The faces have indices of the points of the rings, as one list.\n *\n * The division ignores a corner on the straight line between its two neighbors. A face then has an edge with a corner on it,\n * and the face on the other side of that corner has a different edge. The function divides such a face at each corner on its edge,\n * so two faces with a common border have a common edge.\n */\nfunction facesOf(rings: readonly (readonly Vector2[])[]): number[][] {\n const [outer = [], ...holes] = rings;\n const faces = ShapeUtils.triangulateShape(\n [...outer],\n holes.map((hole) => [...hole]),\n );\n const points = rings.flat();\n const ringOf: number[] = [];\n const spotOf: number[] = [];\n rings.forEach((ring, index) => {\n for (let spot = 0; spot < ring.length; spot++) {\n ringOf.push(index);\n spotOf.push(spot);\n }\n });\n const owner = new Map<number, number>();\n const counts = new Map<number, number>();\n faces.forEach((face, index) => {\n for (let side = 0; side < face.length; side++) {\n const key = edgeKey(at(face, side), at(face, (side + 1) % face.length));\n owner.set(key, index);\n counts.set(key, (counts.get(key) ?? 0) + 1);\n }\n });\n let byLon: number[] | undefined;\n for (const [key, count] of counts) {\n if (count !== 1) continue;\n const u = Math.floor(key / KEY);\n const v = key % KEY;\n const ring = at(ringOf, u);\n const gap = Math.abs(at(spotOf, u) - at(spotOf, v));\n // An edge between two neighbors of a ring is an edge of the outline. It has only one face, and no corner on it.\n if (ring === at(ringOf, v) && (gap === 1 || gap === (rings[ring]?.length ?? 0) - 1)) continue;\n byLon ??= points.map((_, index) => index).sort((one, other) => (points[one]?.x ?? 0) - (points[other]?.x ?? 0));\n divideAt(faces, owner, u, v, cornersOn(points, byLon, u, v));\n }\n return faces;\n}\n\n/**\n * This function gives the place of each point of a ring in the same ring with more points on its edges.\n * It gives `undefined` for a ring whose points are not in the other ring, in the same sequence.\n */\nfunction placesIn(dense: readonly Vector2[], own: readonly Vector2[]): number[] | undefined {\n const places: number[] = [];\n let index = 0;\n for (const point of own) {\n while (index < dense.length && dense[index]?.equals(point) !== true) index++;\n if (index >= dense.length) return undefined;\n places.push(index);\n index += 1;\n }\n return places;\n}\n\n/**\n * This function divides each triangle that has a long edge, at the middle of each long edge. It gives the new triangles,\n * or `undefined` when no edge is long. Two triangles with one edge get the same middle, so the surface has no hole.\n */\nfunction dividePass(triangles: readonly number[], lon: number[], lat: number[], limit: number, middles: Map<number, number>): number[] | undefined {\n const next: number[] = [];\n let divided = false;\n const middle = (a: number, b: number): number => {\n const key = edgeKey(a, b);\n const found = middles.get(key);\n if (found !== undefined) return found;\n lon.push((at(lon, a) + at(lon, b)) / 2);\n lat.push((at(lat, a) + at(lat, b)) / 2);\n middles.set(key, lon.length - 1);\n return lon.length - 1;\n };\n for (let index = 0; index < triangles.length; index += 3) {\n const a = at(triangles, index);\n const b = at(triangles, index + 1);\n const c = at(triangles, index + 2);\n const ab = edgeSize(lon, lat, a, b) > limit;\n const bc = edgeSize(lon, lat, b, c) > limit;\n const ca = edgeSize(lon, lat, c, a) > limit;\n const count = Number(ab) + Number(bc) + Number(ca);\n if (count === 0) {\n next.push(a, b, c);\n continue;\n }\n divided = true;\n if (count === 3) {\n const mab = middle(a, b);\n const mbc = middle(b, c);\n const mca = middle(c, a);\n next.push(a, mab, mca, mab, b, mbc, mca, mbc, c, mab, mbc, mca);\n continue;\n }\n // The corners turn to `p`, `q` and `r`. With one long edge, it is from `p` to `q`. With two long edges, the short edge is from `r` to `p`.\n let p = a;\n let q = b;\n let r = c;\n if (count === 1 ? bc : !ab) {\n p = b;\n q = c;\n r = a;\n } else if (count === 1 ? ca : !bc) {\n p = c;\n q = a;\n r = b;\n }\n const mpq = middle(p, q);\n if (count === 1) {\n next.push(p, mpq, r, mpq, q, r);\n continue;\n }\n const mqr = middle(q, r);\n next.push(mpq, q, mqr);\n // The part with four corners gets the shorter of its two diagonals.\n if (edgeSize(lon, lat, p, mqr) <= edgeSize(lon, lat, mpq, r)) next.push(p, mpq, mqr, p, mqr, r);\n else next.push(p, mpq, r, mpq, mqr, r);\n }\n return divided ? next : undefined;\n}\n\n/**\n * This function divides the surface of a region into triangles that follow the curve of the Earth.\n *\n * `step` is the largest step of an edge of the outline in longitude or latitude, in degrees. The outline is the outline of `densify` with this step:\n * each edge of the outline of the surface is an edge of that outline. So a line through the points of `densify` is exactly on the outline of the surface.\n * An edge in the surface is not longer than 1.25 steps. A step of longitude is as long as it is on the Earth at that latitude, and a quarter of a step at least.\n *\n * A straight edge in the plane is a curve on the Earth. So a flat triangle on a globe is not exactly the triangle in the plane.\n * The difference is small for a small step. It is largest near a pole.\n *\n * The function throws a `GeoError` for a region or a step that is not correct, and a `RangeError` for a surface with too many corners.\n */\nexport function regionSurface(region: Region, step: number, maxCorners: number = MAX_SURFACE_CORNERS): RegionSurface {\n const dense = densify(region, step);\n const ownPolygons = region.type === \"Polygon\" ? [region.coordinates] : region.coordinates;\n const densePolygons = dense.type === \"Polygon\" ? [dense.coordinates] : dense.coordinates;\n const lon: number[] = [];\n const lat: number[] = [];\n let triangles: number[] = [];\n ownPolygons.forEach((polygon, polygonIndex) => {\n // The division into triangles gets the corners of the region only. The corners that `densify` adds are on straight lines, and the division ignores some of them.\n const own: Vector2[][] = [];\n const more: Vector2[][] = [];\n const spots: number[][] = [];\n for (let index = 0; index < polygon.length; index++) {\n const ring = openRing(polygon[index] ?? []);\n if (ring.length < 3) {\n // A polygon whose outer ring has no area has no surface. Its holes are in the outer ring, so they have no surface also.\n if (index === 0) return;\n continue;\n }\n const added = openRing(densePolygons[polygonIndex]?.[index] ?? []);\n const places = placesIn(added, ring);\n own.push(ring);\n more.push(places === undefined ? ring : added);\n spots.push(places ?? ring.map((_, spot) => spot));\n }\n const base = lon.length;\n /** The corner of the surface for each corner of the region, as an index from `base`. */\n const cornerOf: number[] = [];\n const starts: number[] = [];\n more.forEach((ring, index) => {\n const start = lon.length - base;\n starts.push(start);\n for (const spot of spots[index] ?? []) cornerOf.push(start + spot);\n for (const point of ring) {\n lon.push(point.x);\n lat.push(point.y);\n }\n });\n if (lon.length > maxCorners) throw tooManyCorners(maxCorners);\n const faces = facesOf(own).map((face) => face.map((corner) => at(cornerOf, corner)));\n // Each edge of the outline gets the corners that `densify` added to it.\n const owner = ownersOf(faces);\n more.forEach((ring, index) => {\n const places = spots[index] ?? [];\n const start = at(starts, index);\n places.forEach((place, spot) => {\n const next = at(places, (spot + 1) % places.length);\n const run: number[] = [];\n for (let between = (place + 1) % ring.length; between !== next; between = (between + 1) % ring.length) run.push(start + between);\n divideAt(faces, owner, start + place, start + next, run);\n });\n });\n // East is on the right of a person who looks at the Earth from outside with north up. So a counterclockwise triangle in the plane has its front outside.\n // The faces of one polygon have one direction. Their sum tells it, also for a face with almost no area.\n const turnOf = ([a = 0, b = 0, c = 0]: readonly number[]): number =>\n (at(lon, base + b) - at(lon, base + a)) * (at(lat, base + c) - at(lat, base + a)) - (at(lon, base + c) - at(lon, base + a)) * (at(lat, base + b) - at(lat, base + a));\n let turn = 0;\n for (const face of faces) turn += turnOf(face);\n for (const [a = 0, b = 0, c = 0] of faces) {\n if (turn >= 0) triangles.push(base + a, base + b, base + c);\n else triangles.push(base + a, base + c, base + b);\n }\n });\n const limit = step * LONG_EDGE;\n const middles = new Map<number, number>();\n for (let pass = 0; ; pass++) {\n const next = dividePass(triangles, lon, lat, limit, middles);\n if (next === undefined) break;\n triangles = next;\n if (lon.length > maxCorners) throw tooManyCorners(maxCorners);\n if (pass >= MAX_PASSES) throw new RangeError(`The surface of the region has edges longer than ${limit} degrees after ${MAX_PASSES} passes.`);\n }\n const corners = new Float64Array(lon.length * 2);\n for (let index = 0; index < lon.length; index++) {\n corners[index * 2] = at(lon, index);\n corners[index * 2 + 1] = at(lat, index);\n }\n return { corners, triangles: Uint32Array.from(triangles) };\n}\n\nfunction tooManyCorners(maxCorners: number): RangeError {\n return new RangeError(`The surface of the region has more than ${maxCorners} corners. Use a larger step.`);\n}\n\n/** A range of latitudes of an edge on the antimeridian. */\ninterface Cut {\n readonly low: number;\n readonly high: number;\n}\n\n/** This function gives 1 for a longitude of 180 degrees east, -1 for 180 degrees west, and 0 for each other longitude. */\nfunction sideOf(position: Position): number {\n if (Math.abs(position[0] - 180) <= ON_LINE) return 1;\n return Math.abs(position[0] + 180) <= ON_LINE ? -1 : 0;\n}\n\n/** This function gives 1 for the north pole, -1 for the south pole, and 0 for each other latitude. */\nfunction poleOf(position: Position): number {\n if (position[1] >= 90 - ON_LINE) return 1;\n return position[1] <= -90 + ON_LINE ? -1 : 0;\n}\n\n/**\n * This function gives the edges of a region as lines, for the outline that a person sees. Each line is a list of longitudes and latitudes, in degrees:\n * two numbers for each point.\n *\n * `step` is the largest step of a line in longitude or latitude, in degrees. The points are the points of `densify`, so they are corners of `regionSurface`.\n * An edge that is only a cut gets no line. A cut is an edge along a pole, or an edge on the antimeridian with an edge of the region on its other side.\n */\nexport function regionEdges(region: Region, step: number): Float64Array[] {\n const polygons = region.type === \"Polygon\" ? [region.coordinates] : region.coordinates;\n const east: Cut[] = [];\n const west: Cut[] = [];\n for (const polygon of polygons) {\n for (const ring of polygon) {\n for (let index = 0; index + 1 < ring.length; index++) {\n const from = ring[index];\n const to = ring[index + 1];\n if (from === undefined || to === undefined) continue;\n const side = sideOf(from);\n if (side === 0 || side !== sideOf(to)) continue;\n (side > 0 ? east : west).push({ low: Math.min(from[1], to[1]), high: Math.max(from[1], to[1]) });\n }\n }\n }\n const isCut = (from: Position, to: Position): boolean => {\n const pole = poleOf(from);\n if (pole !== 0 && pole === poleOf(to)) return true;\n const side = sideOf(from);\n if (side === 0 || side !== sideOf(to)) return false;\n const low = Math.min(from[1], to[1]);\n const high = Math.max(from[1], to[1]);\n return (side > 0 ? west : east).some((cut) => Math.min(cut.high, high) > Math.max(cut.low, low));\n };\n const lines: Float64Array[] = [];\n const add = (run: readonly Position[]): void => {\n if (run.length < 2) return;\n const dense = densify({ type: \"LineString\", coordinates: [...run] }, step).coordinates;\n const line = new Float64Array(dense.length * 2);\n dense.forEach((position, index) => {\n line[index * 2] = position[0];\n line[index * 2 + 1] = position[1];\n });\n lines.push(line);\n };\n for (const polygon of polygons) {\n for (const ring of polygon) {\n const count = ring.length - 1;\n if (count < 1) continue;\n const cut: boolean[] = [];\n for (let index = 0; index < count; index++) {\n const from = ring[index];\n const to = ring[index + 1];\n cut.push(from === undefined || to === undefined || isCut(from, to));\n }\n const first = cut.indexOf(true);\n if (first < 0) {\n add(ring);\n continue;\n }\n // The walk starts after a cut and goes one time around the ring. So it ends at that cut, and each run of edges is complete.\n let run: Position[] = [];\n for (let steps = 1; steps <= count; steps++) {\n const edge = (first + steps) % count;\n const from = ring[edge];\n const to = ring[edge + 1];\n if (cut[edge] === true || from === undefined || to === undefined) {\n add(run);\n run = [];\n continue;\n }\n if (run.length === 0) run.push(from);\n run.push(to);\n }\n }\n }\n return lines;\n}\n\n/**\n * This function gives the lines of a grid of meridians and parallels. Each line is a list of longitudes and latitudes, in degrees: two numbers for each point.\n *\n * `spacing` is the angle between two lines, in degrees, and `step` is the largest step of a line. A spacing of 0 or less gives no lines.\n * The meridians at each 90 degrees go to the poles. The other meridians stop one spacing before each pole, so the poles stay clear.\n */\nexport function gridLines(spacing: number, step: number): Float64Array[] {\n if (!(spacing > 0) || !(step > 0) || !Number.isFinite(spacing)) return [];\n const lines: Float64Array[] = [];\n const add = (fromLon: number, fromLat: number, toLon: number, toLat: number): void => {\n const parts = Math.max(Math.ceil(Math.max(Math.abs(toLon - fromLon), Math.abs(toLat - fromLat)) / step), 1);\n const line = new Float64Array((parts + 1) * 2);\n for (let part = 0; part <= parts; part++) {\n line[part * 2] = fromLon + ((toLon - fromLon) * part) / parts;\n line[part * 2 + 1] = fromLat + ((toLat - fromLat) * part) / parts;\n }\n lines.push(line);\n };\n const top = (Math.ceil(90 / spacing) - 1) * spacing;\n for (let index = 0; index * spacing < 360 - ON_LINE; index++) {\n const lon = -180 + index * spacing;\n const quarter = Math.abs(lon / 90 - Math.round(lon / 90)) <= ON_LINE;\n const end = quarter ? 90 : top;\n if (end > 0) add(lon, -end, lon, end);\n }\n for (let lat = -top; lat <= top + ON_LINE; lat += spacing) add(-180, lat, 180, lat);\n return lines;\n}\n","import { fromUnitVector, toUnitVector, type LatLon, type Region } from \"@mark1russell7/geo\";\nimport type { Point3 } from \"@mark1russell7/layout-contract\";\nimport { ballView, capView, FIT_MARGIN, type StageView } from \"../extent.ts\";\nimport type { ViewAngles } from \"../view.ts\";\n\n/**\n * The polar limits of the camera of a globe: the camera goes above each pole.\n * Give this value to the option `polar` of a stage. Set the option `pan` to false, so the camera turns around the center of the Earth.\n */\nexport const GLOBE_POLAR: { readonly min: number; readonly max: number } = { min: 0.01, max: Math.PI - 0.01 };\n\nconst RADIANS = Math.PI / 180;\n\n/**\n * This function gives the point of a globe for a place on the Earth. The center of the globe is the origin of the stage.\n *\n * The axis `y` of the stage goes to the north pole. The axis `z` goes to latitude 0 and longitude 0, and the axis `x` goes to latitude 0 and longitude 90 east.\n * `radius` is the distance of the point from the center. The default is 1.\n */\nexport function globePoint(place: LatLon, radius: number = 1): Point3 {\n const unit = toUnitVector(place);\n return { x: unit.y * radius, y: unit.z * radius, z: unit.x * radius };\n}\n\n/**\n * This function gives the place on the Earth in the direction of a point of the stage, as seen from the center of the globe.\n * The center of the globe has no direction, so it gives `undefined`.\n */\nexport function globePlace(point: Point3): LatLon | undefined {\n if (point.x === 0 && point.y === 0 && point.z === 0) return undefined;\n if (!Number.isFinite(point.x) || !Number.isFinite(point.y) || !Number.isFinite(point.z)) return undefined;\n return fromUnitVector({ x: point.z, y: point.x, z: point.y });\n}\n\n/** This function gives the direction of a camera that is above a place on the Earth. */\nexport function globeAngles(place: LatLon): ViewAngles {\n return { polar: Math.PI / 2 - place.lat * RADIANS, azimuth: place.lon * RADIANS };\n}\n\n/**\n * This function makes a view from above a place on the Earth. The picture shows the cap of the Earth around the place.\n *\n * `degrees` is the angle of the cap at the center of the Earth. It is the distance from the place to the edge of the cap, in degrees of a great circle.\n * The default is 90: the picture shows a half of the Earth. `margin` is the space around the cap, as a factor of the height above the surface.\n */\nexport function globeView(place: LatLon, degrees: number = 90, margin: number = FIT_MARGIN): StageView {\n return capView(globeAngles(place), Math.min(Math.max(degrees, 0), 90) * RADIANS, margin);\n}\n\n/**\n * This function makes a view that shows each region of a list. The camera is above the middle of the regions.\n * A list with no regions gives a view of a half of the Earth. `margin` is the space around the regions, as a factor of the height above the surface.\n */\nexport function regionView(regions: readonly Region[], margin: number = FIT_MARGIN): StageView {\n const points: Point3[] = [];\n for (const region of regions) {\n const polygons = region.type === \"Polygon\" ? [region.coordinates] : region.coordinates;\n for (const polygon of polygons) {\n // The first ring of a polygon is its outer edge. A hole is in it, so the holes add no extent.\n for (const position of polygon[0] ?? []) points.push(globePoint({ lat: position[1], lon: position[0] }));\n }\n }\n return ballView(points, margin);\n}\n\n/**\n * This function gives the first point of a ball that a ray finds. The center of the ball is the origin of the stage.\n *\n * `direction` has the length 1. A ray that does not find the ball gives `undefined`, and a ray that starts in the ball also gives `undefined`.\n */\nexport function rayBall(origin: Point3, direction: Point3, radius: number): Point3 | undefined {\n const along = origin.x * direction.x + origin.y * direction.y + origin.z * direction.z;\n const outside = origin.x * origin.x + origin.y * origin.y + origin.z * origin.z - radius * radius;\n if (!(outside > 0)) return undefined;\n const root = along * along - outside;\n if (!(root >= 0)) return undefined;\n const distance = -along - Math.sqrt(root);\n if (!(distance >= 0)) return undefined;\n return { x: origin.x + direction.x * distance, y: origin.y + direction.y * distance, z: origin.z + direction.z * distance };\n}\n\n/**\n * This function tells if a camera at `eye` sees a point of the surface of a ball. The center of the ball is the origin of the stage.\n * A point on the far side of the ball gives false.\n */\nexport function inSight(point: Point3, eye: Point3, radius: number): boolean {\n const length = Math.hypot(point.x, point.y, point.z);\n if (!(length > 0)) return false;\n return (point.x * eye.x + point.y * eye.y + point.z * eye.z) / length > radius;\n}\n","import { pointLocator, type LatLon, type PointLocator, type Region } from \"@mark1russell7/geo\";\nimport type { Point3 } from \"@mark1russell7/layout-contract\";\nimport {\n BufferAttribute,\n BufferGeometry,\n Color,\n FrontSide,\n InstancedInterleavedBuffer,\n InterleavedBufferAttribute,\n Mesh,\n MeshBasicMaterial,\n Points,\n ShaderMaterial,\n Sphere,\n SphereGeometry,\n Vector3,\n type Object3D,\n type Raycaster,\n} from \"three\";\nimport { LineMaterial } from \"three/addons/lines/LineMaterial.js\";\nimport { LineSegments2 } from \"three/addons/lines/LineSegments2.js\";\nimport { LineSegmentsGeometry } from \"three/addons/lines/LineSegmentsGeometry.js\";\nimport type { Highlight } from \"../highlight.ts\";\nimport type { StageContent, StageFrame, StagePick } from \"../stage/stage.ts\";\nimport type { StageTheme } from \"../theme.ts\";\nimport { gridLines, regionEdges, regionSurface, surfaceSag } from \"./mesh.ts\";\nimport { globePlace, globePoint, inSight, rayBall } from \"./space.ts\";\n\n/** The look of the areas and the points of one kind. Each color is a CSS hex color. */\nexport interface GlobeStyle {\n /** The color of the surface of an area, or of a point. An area with no color has no surface, and a point with no color is not in the picture. */\n readonly fill?: string | undefined;\n /** The part of the light that the surface of an area stops, from 0 to 1. The default is 1. */\n readonly opacity?: number | undefined;\n /** The color of the edge of an area, or of the ring around a point. An area with no color has no edge. */\n readonly line?: string | undefined;\n}\n\n/** The colors of a globe. Each color is a CSS hex color. */\nexport interface GlobeTheme extends StageTheme {\n /** The color of the Earth where it has no area, for example the sea. */\n readonly ball: string;\n /** The color of the meridians and the parallels. */\n readonly grid: string;\n /** The color of the shade at the rim of the Earth. */\n readonly shade: string;\n /** The style of each kind of area or point, by the name of the kind. */\n readonly styles: Readonly<Record<string, GlobeStyle>>;\n /** The style of a kind that `styles` does not have. */\n readonly other: GlobeStyle;\n /** The color of the edge of a record under the pointer, or in the highlighted list. */\n readonly hovered: string;\n /** The color of the edge of the selected record. */\n readonly selected: string;\n}\n\n/** An area of a globe: a region of the Earth that belongs to a record. */\nexport interface GlobeArea<P> {\n /** The name of the record. Two parts with one name are one record: the stage highlights them together. */\n readonly record: string;\n /** The region, with edges that are straight lines in longitude and latitude, as in `@mark1russell7/geo`. */\n readonly region: Region;\n /** The name of the style of the area in the theme. */\n readonly kind: string;\n /** The value that a pick of the area gives to the page. */\n readonly value: P;\n /** This value is false for an area that the pointer does not find. The default is true. */\n readonly pick?: boolean | undefined;\n}\n\n/** A point of a globe: a place on the Earth that belongs to a record. The picture shows it as a dot of a constant size. */\nexport interface GlobePoint<P> {\n /** The name of the record. Two parts with one name are one record: the stage highlights them together. */\n readonly record: string;\n readonly place: LatLon;\n /** The name of the style of the point in the theme. */\n readonly kind: string;\n /** The value that a pick of the point gives to the page. */\n readonly value: P;\n /** The width of the dot, in CSS pixels. The default is the option `pointSize` of the globe. */\n readonly size?: number | undefined;\n /** This value is false for a point that the pointer does not find. The default is true. */\n readonly pick?: boolean | undefined;\n}\n\n/** The options of a globe. Each width is in CSS pixels. */\nexport interface GlobeOptions<P> {\n /** The areas, in the sequence of the picture: a later area is above an earlier area, and the pointer finds it first. */\n readonly areas?: readonly GlobeArea<P>[] | undefined;\n /** The points. Each point is above each area. */\n readonly points?: readonly GlobePoint<P>[] | undefined;\n /** The radius of the globe, in the units of the stage. The default is 1. */\n readonly radius?: number | undefined;\n /** The largest step of an edge in longitude or latitude, in degrees. A smaller step follows the curve of the Earth better. The default is 1. */\n readonly step?: number | undefined;\n /** The angle between two lines of the grid, in degrees. The value 0 gives no grid. The default is 15. */\n readonly grid?: number | undefined;\n /** The smallest height of the camera above the surface, as a part of the radius. The default is 0.005. */\n readonly nearest?: number | undefined;\n /** The width of the edge of an area. The default is 1.25. */\n readonly lineWidth?: number | undefined;\n /** The width of the edge of a record with a highlight. The default is 2.5. */\n readonly highlightWidth?: number | undefined;\n /** The width of a line of the grid. The default is 1. */\n readonly gridWidth?: number | undefined;\n /** The width of the dot of a point. The default is 9. */\n readonly pointSize?: number | undefined;\n /** The strength of the shade at the rim of the Earth, from 0 to 1. The default is 0.4. */\n readonly shade?: number | undefined;\n}\n\n/** The content of a stage that shows the Earth as a globe, with areas and points on it. */\nexport interface GlobeContent<P> extends StageContent<P, GlobeTheme> {\n /**\n * This function shows only the areas and the points that a test accepts. A part that the picture does not show gets no pick.\n * Start `refresh` of the stage after it. A test that accepts each part shows all of them again.\n */\n show(test: (part: GlobeArea<P> | GlobePoint<P>) => boolean): void;\n /** This function gives the place on the Earth that a ray from the camera finds. A ray that does not find the Earth gives `undefined`. */\n placeAt(ray: Raycaster): LatLon | undefined;\n}\n\n/** The smallest height of the layer of the areas above the ball, as a part of the radius. */\nconst MIN_LIFT = 0.0005;\n\n/** The opacity that a highlight adds to the surface of an area. */\nconst HIGHLIGHT_OPACITY = 0.16;\n\n/** The factor of the width of a point with a highlight. */\nconst HIGHLIGHT_SIZE = 1.35;\n\n/** The width of the ring around a point, in CSS pixels. */\nconst RING_WIDTH = 1.5;\n\n/**\n * This function gives the radius of the mark of a point of a globe, in CSS pixels. The mark is the dot, and the ring around it.\n * `size` is the width of the dot. Give the result to the field `clear` of a label, so the text stays off the mark.\n */\nexport function pointRadius(size: number): number {\n return size / 2 + RING_WIDTH;\n}\n\n/** The distance around a point where the pointer finds it, in CSS pixels. */\nconst PICK_MARGIN = 4;\n\n/** The exponent of the shade at the rim. A large value keeps the shade near the rim. */\nconst SHADE_POWER = 2.6;\n\nconst BALL_SEGMENTS = 128;\n\nconst SHADE_VERTEX = `\nvarying vec3 vNormal;\nvarying vec3 vToEye;\nvoid main() {\n vec4 inView = modelViewMatrix * vec4(position, 1.0);\n vNormal = normalMatrix * normal;\n vToEye = -inView.xyz;\n gl_Position = projectionMatrix * inView;\n}`;\n\nconst SHADE_FRAGMENT = `\nuniform vec3 shade;\nuniform float strength;\nuniform float power;\nvarying vec3 vNormal;\nvarying vec3 vToEye;\nvoid main() {\n float facing = clamp(dot(normalize(vNormal), normalize(vToEye)), 0.0, 1.0);\n gl_FragColor = vec4(shade, strength * pow(1.0 - facing, power));\n #include <colorspace_fragment>\n}`;\n\nconst POINT_VERTEX = `\nuniform float pixelRatio;\nuniform float ringWidth;\nattribute vec3 fill;\nattribute vec3 ring;\nattribute float size;\nvarying vec3 vFill;\nvarying vec3 vRing;\nvarying float vFade;\nvarying float vInner;\nvoid main() {\n vec4 inWorld = modelMatrix * vec4(position, 1.0);\n vec3 up = normalize(inWorld.xyz - modelMatrix[3].xyz);\n float facing = dot(up, normalize(cameraPosition - inWorld.xyz));\n vFill = fill;\n vRing = ring;\n vFade = smoothstep(0.0, 0.1, facing);\n vInner = size / (size + 2.0 * ringWidth);\n gl_PointSize = (size + 2.0 * ringWidth) * pixelRatio;\n gl_Position = projectionMatrix * viewMatrix * inWorld;\n // A point on the far side of the Earth, and a point that the picture does not show, goes out of the picture.\n if (facing <= 0.0 || size <= 0.0) gl_Position = vec4(2.0, 2.0, 2.0, 1.0);\n}`;\n\nconst POINT_FRAGMENT = `\nvarying vec3 vFill;\nvarying vec3 vRing;\nvarying float vFade;\nvarying float vInner;\nvoid main() {\n float distance = length(gl_PointCoord * 2.0 - 1.0);\n float soft = fwidth(distance);\n float dot = 1.0 - smoothstep(1.0 - soft, 1.0, distance);\n float middle = 1.0 - smoothstep(vInner - soft, vInner, distance);\n gl_FragColor = vec4(mix(vRing, vFill, middle), dot * vFade);\n if (gl_FragColor.a <= 0.0) discard;\n #include <colorspace_fragment>\n}`;\n\n/** An area with the place of its data in the buffers of the globe. */\ninterface AreaPart<P> {\n readonly area: GlobeArea<P>;\n readonly locate: PointLocator | undefined;\n readonly firstCorner: number;\n readonly cornerCount: number;\n readonly firstIndex: number;\n readonly indexCount: number;\n readonly firstSegment: number;\n readonly segmentCount: number;\n shown: boolean;\n filled: boolean;\n lined: boolean;\n highlight: Highlight;\n}\n\n/** A point with its place on the globe. */\ninterface PointPart<P> {\n readonly point: GlobePoint<P>;\n readonly at: Point3;\n readonly size: number;\n shown: boolean;\n filled: boolean;\n highlight: Highlight;\n}\n\n/** This function gives the text of a thrown value. */\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/** This function writes the points of lines into a list of segments on a ball: six numbers for each segment. It gives the count of the segments. */\nfunction addSegments(lines: readonly Float64Array[], radius: number, to: number[]): number {\n let count = 0;\n for (const line of lines) {\n let from: Point3 | undefined;\n for (let index = 0; index + 1 < line.length; index += 2) {\n const next = globePoint({ lat: line[index + 1] ?? 0, lon: line[index] ?? 0 }, radius);\n if (from !== undefined) {\n to.push(from.x, from.y, from.z, next.x, next.y, next.z);\n count += 1;\n }\n from = next;\n }\n }\n return count;\n}\n\n/** This function makes the geometry of thick line segments from a buffer of positions and a buffer of colors: six numbers for each segment. */\nfunction segmentGeometry(positions: InstancedInterleavedBuffer, colors: InstancedInterleavedBuffer | undefined, count: number, bounds: Sphere): LineSegmentsGeometry {\n const geometry = new LineSegmentsGeometry();\n geometry.setAttribute(\"instanceStart\", new InterleavedBufferAttribute(positions, 3, 0));\n geometry.setAttribute(\"instanceEnd\", new InterleavedBufferAttribute(positions, 3, 3));\n if (colors !== undefined) {\n geometry.setAttribute(\"instanceColorStart\", new InterleavedBufferAttribute(colors, 3, 0));\n geometry.setAttribute(\"instanceColorEnd\", new InterleavedBufferAttribute(colors, 3, 3));\n }\n geometry.instanceCount = count;\n geometry.boundingSphere = bounds;\n return geometry;\n}\n\n/**\n * This function makes the content of a stage that shows the Earth as a globe. The center of the globe is the origin of the stage.\n *\n * The materials use no light, so each color in the picture is the color of the theme. Use `GLOBE_POLAR` and no pan in the options of the stage.\n * The function throws an `Error` with the name of the record for an area that is not correct. Its cause is the error of `@mark1russell7/geo`.\n */\nexport function createGlobe<P>(options: GlobeOptions<P> = {}): GlobeContent<P> {\n const radius = options.radius ?? 1;\n const step = options.step ?? 1;\n const layer = radius * (1 + Math.max(MIN_LIFT, surfaceSag(step) * 2));\n const bounds = new Sphere(new Vector3(0, 0, 0), layer);\n const color = new Color();\n\n // The ball, and the shade at its rim.\n const ballGeometry = new SphereGeometry(radius, BALL_SEGMENTS, BALL_SEGMENTS / 2);\n const ballMaterial = new MeshBasicMaterial();\n const ball = new Mesh(ballGeometry, ballMaterial);\n const shadeColor = { value: new Color() };\n const shadeMaterial = new ShaderMaterial({\n uniforms: { shade: shadeColor, strength: { value: Math.min(Math.max(options.shade ?? 0.4, 0), 1) }, power: { value: SHADE_POWER } },\n vertexShader: SHADE_VERTEX,\n fragmentShader: SHADE_FRAGMENT,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n side: FrontSide,\n });\n const shade = new Mesh(ballGeometry, shadeMaterial);\n shade.renderOrder = 4;\n\n // The grid.\n const gridList: number[] = [];\n const gridCount = addSegments(gridLines(options.grid ?? 15, step), layer, gridList);\n const gridMaterial = new LineMaterial({ linewidth: options.gridWidth ?? 1, transparent: true, depthWrite: false });\n const grid = new LineSegments2(segmentGeometry(new InstancedInterleavedBuffer(Float32Array.from(gridList), 6, 1), undefined, gridCount, bounds), gridMaterial);\n grid.renderOrder = 1;\n grid.visible = gridCount > 0;\n grid.frustumCulled = false;\n\n // The areas: one surface and one list of segments for all of them.\n const surfaces: { readonly corners: Float64Array; readonly triangles: Uint32Array }[] = [];\n const segmentList: number[] = [];\n const areaParts: AreaPart<P>[] = [];\n let cornerTotal = 0;\n let indexTotal = 0;\n let segmentTotal = 0;\n for (const area of options.areas ?? []) {\n try {\n const surface = regionSurface(area.region, step);\n const segmentCount = addSegments(regionEdges(area.region, step), layer, segmentList);\n areaParts.push({\n area,\n locate: area.pick === false ? undefined : pointLocator(area.region),\n firstCorner: cornerTotal,\n cornerCount: surface.corners.length / 2,\n firstIndex: indexTotal,\n indexCount: surface.triangles.length,\n firstSegment: segmentTotal,\n segmentCount,\n shown: true,\n filled: false,\n lined: false,\n highlight: 0,\n });\n surfaces.push(surface);\n cornerTotal += surface.corners.length / 2;\n indexTotal += surface.triangles.length;\n segmentTotal += segmentCount;\n } catch (error) {\n throw new Error(`The area of the record ${area.record} is not correct: ${messageOf(error)}`, { cause: error });\n }\n }\n const fillPositions = new Float32Array(cornerTotal * 3);\n const allIndices = new Uint32Array(indexTotal);\n surfaces.forEach((surface, index) => {\n const part = areaParts[index];\n if (part === undefined) return;\n for (let corner = 0; corner < part.cornerCount; corner++) {\n const point = globePoint({ lat: surface.corners[corner * 2 + 1] ?? 0, lon: surface.corners[corner * 2] ?? 0 }, layer);\n fillPositions.set([point.x, point.y, point.z], (part.firstCorner + corner) * 3);\n }\n for (let at = 0; at < part.indexCount; at++) allIndices[part.firstIndex + at] = (surface.triangles[at] ?? 0) + part.firstCorner;\n });\n const fillColors = new BufferAttribute(new Float32Array(cornerTotal * 4), 4);\n const fillIndices = new BufferAttribute(new Uint32Array(indexTotal), 1);\n const fillGeometry = new BufferGeometry();\n fillGeometry.setAttribute(\"position\", new BufferAttribute(fillPositions, 3));\n fillGeometry.setAttribute(\"color\", fillColors);\n fillGeometry.setIndex(fillIndices);\n fillGeometry.boundingSphere = bounds;\n const fillMaterial = new MeshBasicMaterial({ vertexColors: true, transparent: true, depthWrite: false, side: FrontSide });\n const fills = new Mesh(fillGeometry, fillMaterial);\n fills.renderOrder = 2;\n fills.frustumCulled = false;\n\n // The edges of the areas. The picture draws the segments at the start of the buffers, so the segments of the shown areas are there.\n const allSegments = Float32Array.from(segmentList);\n const allSegmentColors = new Float32Array(allSegments.length);\n const edgePositions = new InstancedInterleavedBuffer(new Float32Array(allSegments.length), 6, 1);\n const edgeColors = new InstancedInterleavedBuffer(new Float32Array(allSegments.length), 6, 1);\n const edgeGeometry = segmentGeometry(edgePositions, edgeColors, 0, bounds);\n const edgeMaterial = new LineMaterial({ linewidth: options.lineWidth ?? 1.25, vertexColors: true, transparent: true, depthWrite: false });\n const edges = new LineSegments2(edgeGeometry, edgeMaterial);\n edges.renderOrder = 3;\n edges.frustumCulled = false;\n\n // The edges of the records with a highlight, above the other edges.\n const highlightMaterial = new LineMaterial({ linewidth: options.highlightWidth ?? 2.5, vertexColors: true, transparent: true, depthWrite: false });\n const highlighted = new LineSegments2(new LineSegmentsGeometry(), highlightMaterial);\n highlighted.renderOrder = 5;\n highlighted.frustumCulled = false;\n highlighted.visible = false;\n\n // The points.\n const pointSize = options.pointSize ?? 9;\n const pointParts: PointPart<P>[] = (options.points ?? []).map((point) => ({\n point,\n at: globePoint(point.place, layer),\n size: point.size ?? pointSize,\n shown: true,\n filled: false,\n highlight: 0,\n }));\n const pointPositions = new Float32Array(pointParts.length * 3);\n pointParts.forEach((part, index) => pointPositions.set([part.at.x, part.at.y, part.at.z], index * 3));\n const pointFills = new BufferAttribute(new Float32Array(pointParts.length * 3), 3);\n const pointRings = new BufferAttribute(new Float32Array(pointParts.length * 3), 3);\n const pointSizes = new BufferAttribute(new Float32Array(pointParts.length), 1);\n const pointGeometry = new BufferGeometry();\n pointGeometry.setAttribute(\"position\", new BufferAttribute(pointPositions, 3));\n pointGeometry.setAttribute(\"fill\", pointFills);\n pointGeometry.setAttribute(\"ring\", pointRings);\n pointGeometry.setAttribute(\"size\", pointSizes);\n pointGeometry.boundingSphere = bounds;\n const pixelRatio = { value: 1 };\n const pointMaterial = new ShaderMaterial({\n uniforms: { pixelRatio, ringWidth: { value: RING_WIDTH } },\n vertexShader: POINT_VERTEX,\n fragmentShader: POINT_FRAGMENT,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n });\n const dots = new Points(pointGeometry, pointMaterial);\n dots.renderOrder = 6;\n dots.frustumCulled = false;\n dots.visible = pointParts.length > 0;\n // The size of a dot is in CSS pixels, and the picture can have more than one pixel for each CSS pixel.\n dots.onBeforeRender = (renderer): void => {\n pixelRatio.value = renderer.getPixelRatio();\n };\n\n const records = new Set<string>([...areaParts.map((part) => part.area.record), ...pointParts.map((part) => part.point.record)]);\n let painted: GlobeTheme | undefined;\n /** The angle of one CSS pixel at the middle of the picture, in radians. */\n let pixelAngle = 0.001;\n\n const styleOf = (theme: GlobeTheme, kind: string): GlobeStyle => theme.styles[kind] ?? theme.other;\n const highlightColor = (theme: GlobeTheme, highlight: Highlight): string => (highlight === 2 ? theme.selected : theme.hovered);\n\n /** This function writes the colors of an area into the buffers. */\n const paintArea = (part: AreaPart<P>, theme: GlobeTheme): void => {\n const style = styleOf(theme, part.area.kind);\n part.filled = style.fill !== undefined;\n part.lined = style.line !== undefined;\n if (style.fill !== undefined) {\n color.set(style.fill);\n const opacity = Math.min(Math.max(style.opacity ?? 1, 0), 1);\n const alpha = part.highlight === 0 ? opacity : Math.min(opacity + HIGHLIGHT_OPACITY, 1);\n const values = [color.r, color.g, color.b, alpha];\n for (let corner = 0; corner < part.cornerCount; corner++) fillColors.array.set(values, (part.firstCorner + corner) * 4);\n fillColors.needsUpdate = true;\n }\n if (style.line !== undefined) {\n color.set(style.line);\n const values = [color.r, color.g, color.b, color.r, color.g, color.b];\n for (let segment = 0; segment < part.segmentCount; segment++) allSegmentColors.set(values, (part.firstSegment + segment) * 6);\n }\n };\n\n /** This function puts the data of the shown parts at the start of the buffers that the picture draws. */\n const sync = (theme: GlobeTheme): void => {\n let indexCount = 0;\n let segmentCount = 0;\n let highlightCount = 0;\n for (const part of areaParts) {\n if (!part.shown) continue;\n if (part.filled) {\n fillIndices.array.set(allIndices.subarray(part.firstIndex, part.firstIndex + part.indexCount), indexCount);\n indexCount += part.indexCount;\n }\n if (part.lined) {\n const from = part.firstSegment * 6;\n const to = from + part.segmentCount * 6;\n edgePositions.array.set(allSegments.subarray(from, to), segmentCount * 6);\n edgeColors.array.set(allSegmentColors.subarray(from, to), segmentCount * 6);\n segmentCount += part.segmentCount;\n }\n if (part.highlight !== 0) highlightCount += part.segmentCount;\n }\n fillIndices.needsUpdate = true;\n fillGeometry.setDrawRange(0, indexCount);\n fills.visible = indexCount > 0;\n edgePositions.needsUpdate = true;\n edgeColors.needsUpdate = true;\n edgeGeometry.instanceCount = segmentCount;\n edges.visible = segmentCount > 0;\n\n // The edges of the records with a highlight get a new geometry. They are few, and a record changes its highlight only on an act of a person.\n const highlightPositions = new Float32Array(highlightCount * 6);\n const highlightColors = new Float32Array(highlightCount * 6);\n let at = 0;\n for (const part of areaParts) {\n if (!part.shown || part.highlight === 0) continue;\n color.set(highlightColor(theme, part.highlight));\n const values = [color.r, color.g, color.b, color.r, color.g, color.b];\n highlightPositions.set(allSegments.subarray(part.firstSegment * 6, (part.firstSegment + part.segmentCount) * 6), at * 6);\n for (let segment = 0; segment < part.segmentCount; segment++) highlightColors.set(values, (at + segment) * 6);\n at += part.segmentCount;\n }\n highlighted.geometry.dispose();\n highlighted.geometry =\n highlightCount > 0 ? segmentGeometry(new InstancedInterleavedBuffer(highlightPositions, 6, 1), new InstancedInterleavedBuffer(highlightColors, 6, 1), highlightCount, bounds) : new LineSegmentsGeometry();\n highlighted.visible = highlightCount > 0;\n\n pointParts.forEach((part, index) => {\n const style = styleOf(theme, part.point.kind);\n part.filled = style.fill !== undefined;\n const visible = part.shown && style.fill !== undefined;\n pointSizes.array[index] = visible ? part.size * (part.highlight === 0 ? 1 : HIGHLIGHT_SIZE) : 0;\n if (style.fill === undefined) return;\n color.set(style.fill);\n pointFills.array.set([color.r, color.g, color.b], index * 3);\n color.set(part.highlight === 0 ? (style.line ?? style.fill) : highlightColor(theme, part.highlight));\n pointRings.array.set([color.r, color.g, color.b], index * 3);\n });\n pointSizes.needsUpdate = true;\n pointFills.needsUpdate = true;\n pointRings.needsUpdate = true;\n };\n\n return {\n objects: [ball, grid, fills, edges, shade, highlighted, dots] satisfies Object3D[],\n extent: { center: { x: 0, y: 0, z: 0 }, corners: [], surface: radius, minDistance: radius * (1 + Math.max(options.nearest ?? 0.005, 1e-6)) },\n has: (record) => records.has(record),\n pick(ray): StagePick<P> | undefined {\n const { origin, direction } = ray.ray;\n let found: PointPart<P> | undefined;\n let nearest = Infinity;\n for (const part of pointParts) {\n if (!part.shown || !part.filled || part.point.pick === false || !inSight(part.at, origin, radius)) continue;\n const x = part.at.x - origin.x;\n const y = part.at.y - origin.y;\n const z = part.at.z - origin.z;\n const cosine = (x * direction.x + y * direction.y + z * direction.z) / Math.hypot(x, y, z);\n const angle = Math.acos(Math.min(Math.max(cosine, -1), 1));\n if (angle > (part.size / 2 + PICK_MARGIN) * pixelAngle || angle >= nearest) continue;\n found = part;\n nearest = angle;\n }\n if (found !== undefined) return { record: found.point.record, value: found.point.value };\n const hit = rayBall(origin, direction, radius);\n const place = hit === undefined ? undefined : globePlace(hit);\n if (place === undefined) return undefined;\n for (let index = areaParts.length - 1; index >= 0; index--) {\n const part = areaParts[index];\n if (part === undefined || !part.shown || part.locate === undefined || !(part.filled || part.lined)) continue;\n if (part.locate(place) !== \"outside\") return { record: part.area.record, value: part.area.value };\n }\n return undefined;\n },\n paint(theme, highlight): void {\n const all = theme !== painted;\n painted = theme;\n if (all) {\n ballMaterial.color.set(theme.ball);\n gridMaterial.color.set(theme.grid);\n shadeColor.value.set(theme.shade);\n }\n for (const part of areaParts) {\n const next = highlight(part.area.record);\n if (!all && next === part.highlight) continue;\n part.highlight = next;\n paintArea(part, theme);\n }\n for (const part of pointParts) part.highlight = highlight(part.point.record);\n sync(theme);\n },\n step(frame: StageFrame): boolean {\n pixelAngle = (2 * Math.tan((frame.fieldOfView * Math.PI) / 360)) / Math.max(frame.height, 1);\n return false;\n },\n show(test): void {\n for (const part of areaParts) part.shown = test(part.area);\n for (const part of pointParts) part.shown = test(part.point);\n if (painted !== undefined) sync(painted);\n },\n placeAt(ray): LatLon | undefined {\n const hit = rayBall(ray.ray.origin, ray.ray.direction, radius);\n return hit === undefined ? undefined : globePlace(hit);\n },\n dispose(): void {\n ballGeometry.dispose();\n ballMaterial.dispose();\n shadeMaterial.dispose();\n grid.geometry.dispose();\n gridMaterial.dispose();\n fillGeometry.dispose();\n fillMaterial.dispose();\n edgeGeometry.dispose();\n edgeMaterial.dispose();\n highlighted.geometry.dispose();\n highlightMaterial.dispose();\n pointGeometry.dispose();\n pointMaterial.dispose();\n },\n };\n}\n"],"mappings":";;;;;;;;AAeA,MAAa,sBAAsB;;;;;AAMnC,MAAM,YAAY;;;;;;AAOlB,MAAM,YAAY;;AAGlB,MAAM,aAAa;;AAGnB,MAAM,MAAM,KAAK;;AAGjB,MAAM,UAAU;;AAGhB,MAAM,UAAU;AAEhB,MAAMA,YAAU,KAAK,KAAK;;AAG1B,SAAS,GAAG,MAAyB,OAAuB;CAC1D,OAAO,KAAK,UAAU;AACxB;AAEA,SAAS,QAAQ,GAAW,GAAmB;CAC7C,OAAO,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,MAAM;AACzC;;;;;AAMA,SAAgB,WAAW,MAAsB;CAG/C,OAAO,IAAI,KAAK,IAAK,OAAOA,YAAU,YAAY,KAAK,QAAS,KAAK,KAAK,CAAC,CAAC;AAC9E;;AAGA,SAAS,SAAS,MAAsC;CACtD,MAAM,SAAoB,CAAC;CAC3B,KAAK,MAAM,YAAY,MAAM;EAC3B,MAAM,OAAO,OAAO,OAAO,SAAS;EACpC,IAAI,SAA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AAgB;GACd,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,cAAc,QAAQ;GACtB,KAAK,SAAS,QAAQ;GACtB,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,YAAY,SAAS,QAAQ;GAC7B,kBAAkB,QAAQ;GAC1B,cAAc,QAAQ;GACtB,cAAc,QAAQ;EACxB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"globe.js","names":["RADIANS"],"sources":["../src/globe/mesh.ts","../src/globe/space.ts","../src/globe/content.ts"],"sourcesContent":["import { densify, type Position, type Region } from \"@mark1russell7/geo\";\nimport { ShapeUtils, Vector2 } from \"three\";\n\n/**\n * The surface of a region as triangles. The region and the triangles are in the plane of longitude and latitude,\n * as the polygon tests of `@mark1russell7/geo` are. So a triangle does not go across the antimeridian.\n */\nexport interface RegionSurface {\n /** The longitude and the latitude of each corner, in degrees: two numbers for each corner. */\n readonly corners: Float64Array;\n /** The three corners of each triangle, as indices of corners. Each triangle is counterclockwise in the plane, with east on the right and north up. */\n readonly triangles: Uint32Array;\n}\n\n/** The largest count of corners of the surface of one region. A smaller step gives more corners. */\nexport const MAX_SURFACE_CORNERS = 2_000_000;\n\n/**\n * The longest edge in a surface, as a factor of the step. An edge of the outline is not longer than the step.\n * An edge in the surface can be longer by this factor, so the count of the passes has a small limit.\n */\nconst LONG_EDGE = 1.25;\n\n/**\n * The smallest length of a degree of longitude in the size of an edge, as a part of a degree at the equator.\n * Near a pole, a degree of longitude is short, and an edge can go across many of them. This limit keeps such an edge to 5 steps of longitude.\n * A straight edge on the Earth is not a straight line in longitude and latitude. The two are far apart for an edge across many degrees.\n */\nconst MIN_WIDTH = 0.25;\n\n/** The largest count of passes that divide the long edges. Each pass makes the longest edge shorter by almost a half. */\nconst MAX_PASSES = 48;\n\n/** The factor of the first corner in the key of an edge. A key is an exact integer for each pair of corners below this count. */\nconst KEY = 2 ** 26;\n\n/** The largest distance of a corner from an edge that it is on, as a part of the length of the edge. */\nconst ON_EDGE = 1e-12;\n\n/** The largest distance of a longitude from 180 degrees, or of a latitude from 90 degrees, that is on the antimeridian or on a pole. */\nconst ON_LINE = 1e-9;\n\nconst RADIANS = Math.PI / 180;\n\n/** This function gives one number of a list. The index is always in the list, so the default 0 has no use. */\nfunction at(list: ArrayLike<number>, index: number): number {\n return list[index] ?? 0;\n}\n\nfunction edgeKey(a: number, b: number): number {\n return a < b ? a * KEY + b : b * KEY + a;\n}\n\n/**\n * This function gives the height of the flat triangles of a surface below a ball of radius 1, at most.\n * A layer at this height above a ball does not go into the ball. `step` is the step of the surface, in degrees.\n */\nexport function surfaceSag(step: number): number {\n // A triangle with no edge longer than `a` on a ball is below the ball by 1 - cos(a / sqrt 3) at most.\n // An edge with a step of `s` in longitude and in latitude has the length s * sqrt 2 at most.\n return 1 - Math.cos((step * RADIANS * LONG_EDGE * Math.SQRT2) / Math.sqrt(3));\n}\n\n/** This function gives the points of a ring, each one time. A point is different from the point before it, and the last point is different from the first point. */\nfunction openRing(ring: readonly Position[]): Vector2[] {\n const points: Vector2[] = [];\n for (const position of ring) {\n const last = points[points.length - 1];\n if (last === undefined || last.x !== position[0] || last.y !== position[1]) points.push(new Vector2(position[0], position[1]));\n }\n const first = points[0];\n while (points.length > 1 && first !== undefined && points[points.length - 1]?.equals(first) === true) points.pop();\n return points;\n}\n\n/**\n * This function gives the size of an edge for the division of a surface, in degrees. The size is the larger of its steps in latitude and in longitude.\n * A step of longitude is as long as it is on the Earth, at the end of the edge that is nearer to the equator.\n */\nfunction edgeSize(lon: readonly number[], lat: readonly number[], a: number, b: number): number {\n const latA = at(lat, a);\n const latB = at(lat, b);\n const wide = Math.abs(at(lon, a) - at(lon, b)) * Math.max(Math.cos(Math.min(Math.abs(latA), Math.abs(latB)) * RADIANS), MIN_WIDTH);\n return Math.max(Math.abs(latA - latB), wide);\n}\n\n/** This function gives, for each edge of a list of faces, a face that has it. An edge of an outline has only one face. */\nfunction ownersOf(faces: readonly (readonly number[])[]): Map<number, number> {\n const owner = new Map<number, number>();\n faces.forEach((face, index) => {\n for (let side = 0; side < face.length; side++) owner.set(edgeKey(at(face, side), at(face, (side + 1) % face.length)), index);\n });\n return owner;\n}\n\n/**\n * This function divides the face with the edge from `a` to `b` at each corner of `run`. The corners of `run` are on the edge, in the sequence from `a` to `b`.\n * Each new face has the third corner of the face, and the direction of the face. An edge with no face changes nothing.\n */\nfunction divideAt(faces: number[][], owner: Map<number, number>, a: number, b: number, run: readonly number[]): void {\n const index = owner.get(edgeKey(a, b));\n const face = index === undefined ? undefined : faces[index];\n const c = face?.find((corner) => corner !== a && corner !== b);\n if (index === undefined || face === undefined || c === undefined || run.length === 0) return;\n const forward = face[(face.indexOf(a) + 1) % 3] === b;\n const chain = [a, ...run, b];\n for (let piece = 0; piece + 1 < chain.length; piece++) {\n const from = at(chain, piece);\n const to = at(chain, piece + 1);\n const place = piece === 0 ? index : faces.length;\n faces[place] = forward ? [from, to, c] : [to, from, c];\n owner.set(edgeKey(from, to), place);\n if (piece === 0) owner.set(edgeKey(a, c), place);\n if (piece === chain.length - 2) owner.set(edgeKey(b, c), place);\n }\n}\n\n/**\n * This function gives the corners that are on the edge from `u` to `v`, between its ends, in the sequence from `u` to `v`.\n * `byLon` has each corner, from the smallest longitude to the largest.\n */\nfunction cornersOn(points: readonly Vector2[], byLon: readonly number[], u: number, v: number): number[] {\n const from = points[u];\n const to = points[v];\n if (from === undefined || to === undefined) return [];\n const dx = to.x - from.x;\n const dy = to.y - from.y;\n const square = dx * dx + dy * dy;\n if (!(square > 0)) return [];\n const slack = Math.sqrt(square) * ON_EDGE;\n const low = Math.min(from.x, to.x) - slack;\n const high = Math.max(from.x, to.x) + slack;\n let first = 0;\n let end = byLon.length;\n while (first < end) {\n const middle = (first + end) >> 1;\n if ((points[at(byLon, middle)]?.x ?? Infinity) < low) first = middle + 1;\n else end = middle;\n }\n const found: { readonly corner: number; readonly part: number }[] = [];\n for (let index = first; index < byLon.length; index++) {\n const corner = at(byLon, index);\n const point = points[corner];\n if (point === undefined || point.x > high) break;\n if (corner === u || corner === v) continue;\n const px = point.x - from.x;\n const py = point.y - from.y;\n const part = (px * dx + py * dy) / square;\n if (part > 0 && part < 1 && Math.abs(px * dy - py * dx) <= square * ON_EDGE) found.push({ corner, part });\n }\n return found.sort((one, other) => one.part - other.part).map(({ corner }) => corner);\n}\n\n/**\n * This function divides a polygon into triangles. Each ring has no point two times in sequence. The faces have indices of the points of the rings, as one list.\n *\n * The division ignores a corner on the straight line between its two neighbors. A face then has an edge with a corner on it,\n * and the face on the other side of that corner has a different edge. The function divides such a face at each corner on its edge,\n * so two faces with a common border have a common edge.\n */\nfunction facesOf(rings: readonly (readonly Vector2[])[]): number[][] {\n const [outer = [], ...holes] = rings;\n const faces = ShapeUtils.triangulateShape(\n [...outer],\n holes.map((hole) => [...hole]),\n );\n const points = rings.flat();\n const ringOf: number[] = [];\n const spotOf: number[] = [];\n rings.forEach((ring, index) => {\n for (let spot = 0; spot < ring.length; spot++) {\n ringOf.push(index);\n spotOf.push(spot);\n }\n });\n const owner = new Map<number, number>();\n const counts = new Map<number, number>();\n faces.forEach((face, index) => {\n for (let side = 0; side < face.length; side++) {\n const key = edgeKey(at(face, side), at(face, (side + 1) % face.length));\n owner.set(key, index);\n counts.set(key, (counts.get(key) ?? 0) + 1);\n }\n });\n let byLon: number[] | undefined;\n for (const [key, count] of counts) {\n if (count !== 1) continue;\n const u = Math.floor(key / KEY);\n const v = key % KEY;\n const ring = at(ringOf, u);\n const gap = Math.abs(at(spotOf, u) - at(spotOf, v));\n // An edge between two neighbors of a ring is an edge of the outline. It has only one face, and no corner on it.\n if (ring === at(ringOf, v) && (gap === 1 || gap === (rings[ring]?.length ?? 0) - 1)) continue;\n byLon ??= points.map((_, index) => index).sort((one, other) => (points[one]?.x ?? 0) - (points[other]?.x ?? 0));\n divideAt(faces, owner, u, v, cornersOn(points, byLon, u, v));\n }\n return faces;\n}\n\n/**\n * This function gives the place of each point of a ring in the same ring with more points on its edges.\n * It gives `undefined` for a ring whose points are not in the other ring, in the same sequence.\n */\nfunction placesIn(dense: readonly Vector2[], own: readonly Vector2[]): number[] | undefined {\n const places: number[] = [];\n let index = 0;\n for (const point of own) {\n while (index < dense.length && dense[index]?.equals(point) !== true) index++;\n if (index >= dense.length) return undefined;\n places.push(index);\n index += 1;\n }\n return places;\n}\n\n/**\n * This function divides each triangle that has a long edge, at the middle of each long edge. It gives the new triangles,\n * or `undefined` when no edge is long. Two triangles with one edge get the same middle, so the surface has no hole.\n */\nfunction dividePass(triangles: readonly number[], lon: number[], lat: number[], limit: number, middles: Map<number, number>): number[] | undefined {\n const next: number[] = [];\n let divided = false;\n const middle = (a: number, b: number): number => {\n const key = edgeKey(a, b);\n const found = middles.get(key);\n if (found !== undefined) return found;\n lon.push((at(lon, a) + at(lon, b)) / 2);\n lat.push((at(lat, a) + at(lat, b)) / 2);\n middles.set(key, lon.length - 1);\n return lon.length - 1;\n };\n for (let index = 0; index < triangles.length; index += 3) {\n const a = at(triangles, index);\n const b = at(triangles, index + 1);\n const c = at(triangles, index + 2);\n const ab = edgeSize(lon, lat, a, b) > limit;\n const bc = edgeSize(lon, lat, b, c) > limit;\n const ca = edgeSize(lon, lat, c, a) > limit;\n const count = Number(ab) + Number(bc) + Number(ca);\n if (count === 0) {\n next.push(a, b, c);\n continue;\n }\n divided = true;\n if (count === 3) {\n const mab = middle(a, b);\n const mbc = middle(b, c);\n const mca = middle(c, a);\n next.push(a, mab, mca, mab, b, mbc, mca, mbc, c, mab, mbc, mca);\n continue;\n }\n // The corners turn to `p`, `q` and `r`. With one long edge, it is from `p` to `q`. With two long edges, the short edge is from `r` to `p`.\n let p = a;\n let q = b;\n let r = c;\n if (count === 1 ? bc : !ab) {\n p = b;\n q = c;\n r = a;\n } else if (count === 1 ? ca : !bc) {\n p = c;\n q = a;\n r = b;\n }\n const mpq = middle(p, q);\n if (count === 1) {\n next.push(p, mpq, r, mpq, q, r);\n continue;\n }\n const mqr = middle(q, r);\n next.push(mpq, q, mqr);\n // The part with four corners gets the shorter of its two diagonals.\n if (edgeSize(lon, lat, p, mqr) <= edgeSize(lon, lat, mpq, r)) next.push(p, mpq, mqr, p, mqr, r);\n else next.push(p, mpq, r, mpq, mqr, r);\n }\n return divided ? next : undefined;\n}\n\n/**\n * This function divides the surface of a region into triangles that follow the curve of the Earth.\n *\n * `step` is the largest step of an edge of the outline in longitude or latitude, in degrees. The outline is the outline of `densify` with this step:\n * each edge of the outline of the surface is an edge of that outline. So a line through the points of `densify` is exactly on the outline of the surface.\n * An edge in the surface is not longer than 1.25 steps. A step of longitude is as long as it is on the Earth at that latitude, and a quarter of a step at least.\n *\n * A straight edge in the plane is a curve on the Earth. So a flat triangle on a globe is not exactly the triangle in the plane.\n * The difference is small for a small step. It is largest near a pole.\n *\n * The function throws a `GeoError` for a region or a step that is not correct, and a `RangeError` for a surface with too many corners.\n */\nexport function regionSurface(region: Region, step: number, maxCorners: number = MAX_SURFACE_CORNERS): RegionSurface {\n const dense = densify(region, step);\n const ownPolygons = region.type === \"Polygon\" ? [region.coordinates] : region.coordinates;\n const densePolygons = dense.type === \"Polygon\" ? [dense.coordinates] : dense.coordinates;\n const lon: number[] = [];\n const lat: number[] = [];\n let triangles: number[] = [];\n ownPolygons.forEach((polygon, polygonIndex) => {\n // The division into triangles gets the corners of the region only. The corners that `densify` adds are on straight lines, and the division ignores some of them.\n const own: Vector2[][] = [];\n const more: Vector2[][] = [];\n const spots: number[][] = [];\n for (let index = 0; index < polygon.length; index++) {\n const ring = openRing(polygon[index] ?? []);\n if (ring.length < 3) {\n // A polygon whose outer ring has no area has no surface. Its holes are in the outer ring, so they have no surface also.\n if (index === 0) return;\n continue;\n }\n const added = openRing(densePolygons[polygonIndex]?.[index] ?? []);\n const places = placesIn(added, ring);\n own.push(ring);\n more.push(places === undefined ? ring : added);\n spots.push(places ?? ring.map((_, spot) => spot));\n }\n const base = lon.length;\n /** The corner of the surface for each corner of the region, as an index from `base`. */\n const cornerOf: number[] = [];\n const starts: number[] = [];\n more.forEach((ring, index) => {\n const start = lon.length - base;\n starts.push(start);\n for (const spot of spots[index] ?? []) cornerOf.push(start + spot);\n for (const point of ring) {\n lon.push(point.x);\n lat.push(point.y);\n }\n });\n if (lon.length > maxCorners) throw tooManyCorners(maxCorners);\n const faces = facesOf(own).map((face) => face.map((corner) => at(cornerOf, corner)));\n // Each edge of the outline gets the corners that `densify` added to it.\n const owner = ownersOf(faces);\n more.forEach((ring, index) => {\n const places = spots[index] ?? [];\n const start = at(starts, index);\n places.forEach((place, spot) => {\n const next = at(places, (spot + 1) % places.length);\n const run: number[] = [];\n for (let between = (place + 1) % ring.length; between !== next; between = (between + 1) % ring.length) run.push(start + between);\n divideAt(faces, owner, start + place, start + next, run);\n });\n });\n // East is on the right of a person who looks at the Earth from outside with north up. So a counterclockwise triangle in the plane has its front outside.\n // The faces of one polygon have one direction. Their sum tells it, also for a face with almost no area.\n const turnOf = ([a = 0, b = 0, c = 0]: readonly number[]): number =>\n (at(lon, base + b) - at(lon, base + a)) * (at(lat, base + c) - at(lat, base + a)) - (at(lon, base + c) - at(lon, base + a)) * (at(lat, base + b) - at(lat, base + a));\n let turn = 0;\n for (const face of faces) turn += turnOf(face);\n for (const [a = 0, b = 0, c = 0] of faces) {\n if (turn >= 0) triangles.push(base + a, base + b, base + c);\n else triangles.push(base + a, base + c, base + b);\n }\n });\n const limit = step * LONG_EDGE;\n const middles = new Map<number, number>();\n for (let pass = 0; ; pass++) {\n const next = dividePass(triangles, lon, lat, limit, middles);\n if (next === undefined) break;\n triangles = next;\n if (lon.length > maxCorners) throw tooManyCorners(maxCorners);\n if (pass >= MAX_PASSES) throw new RangeError(`The surface of the region has edges longer than ${limit} degrees after ${MAX_PASSES} passes.`);\n }\n const corners = new Float64Array(lon.length * 2);\n for (let index = 0; index < lon.length; index++) {\n corners[index * 2] = at(lon, index);\n corners[index * 2 + 1] = at(lat, index);\n }\n return { corners, triangles: Uint32Array.from(triangles) };\n}\n\nfunction tooManyCorners(maxCorners: number): RangeError {\n return new RangeError(`The surface of the region has more than ${maxCorners} corners. Use a larger step.`);\n}\n\n/** A range of latitudes of an edge on the antimeridian. */\ninterface Cut {\n readonly low: number;\n readonly high: number;\n}\n\n/** This function gives 1 for a longitude of 180 degrees east, -1 for 180 degrees west, and 0 for each other longitude. */\nfunction sideOf(position: Position): number {\n if (Math.abs(position[0] - 180) <= ON_LINE) return 1;\n return Math.abs(position[0] + 180) <= ON_LINE ? -1 : 0;\n}\n\n/** This function gives 1 for the north pole, -1 for the south pole, and 0 for each other latitude. */\nfunction poleOf(position: Position): number {\n if (position[1] >= 90 - ON_LINE) return 1;\n return position[1] <= -90 + ON_LINE ? -1 : 0;\n}\n\n/**\n * This function gives the edges of a region as lines, for the outline that a person sees. Each line is a list of longitudes and latitudes, in degrees:\n * two numbers for each point.\n *\n * `step` is the largest step of a line in longitude or latitude, in degrees. The points are the points of `densify`, so they are corners of `regionSurface`.\n * An edge that is only a cut gets no line. A cut is an edge along a pole, or an edge on the antimeridian with an edge of the region on its other side.\n */\nexport function regionEdges(region: Region, step: number): Float64Array[] {\n const polygons = region.type === \"Polygon\" ? [region.coordinates] : region.coordinates;\n const east: Cut[] = [];\n const west: Cut[] = [];\n for (const polygon of polygons) {\n for (const ring of polygon) {\n for (let index = 0; index + 1 < ring.length; index++) {\n const from = ring[index];\n const to = ring[index + 1];\n if (from === undefined || to === undefined) continue;\n const side = sideOf(from);\n if (side === 0 || side !== sideOf(to)) continue;\n (side > 0 ? east : west).push({ low: Math.min(from[1], to[1]), high: Math.max(from[1], to[1]) });\n }\n }\n }\n const isCut = (from: Position, to: Position): boolean => {\n const pole = poleOf(from);\n if (pole !== 0 && pole === poleOf(to)) return true;\n const side = sideOf(from);\n if (side === 0 || side !== sideOf(to)) return false;\n const low = Math.min(from[1], to[1]);\n const high = Math.max(from[1], to[1]);\n return (side > 0 ? west : east).some((cut) => Math.min(cut.high, high) > Math.max(cut.low, low));\n };\n const lines: Float64Array[] = [];\n const add = (run: readonly Position[]): void => {\n if (run.length < 2) return;\n const dense = densify({ type: \"LineString\", coordinates: [...run] }, step).coordinates;\n const line = new Float64Array(dense.length * 2);\n dense.forEach((position, index) => {\n line[index * 2] = position[0];\n line[index * 2 + 1] = position[1];\n });\n lines.push(line);\n };\n for (const polygon of polygons) {\n for (const ring of polygon) {\n const count = ring.length - 1;\n if (count < 1) continue;\n const cut: boolean[] = [];\n for (let index = 0; index < count; index++) {\n const from = ring[index];\n const to = ring[index + 1];\n cut.push(from === undefined || to === undefined || isCut(from, to));\n }\n const first = cut.indexOf(true);\n if (first < 0) {\n add(ring);\n continue;\n }\n // The walk starts after a cut and goes one time around the ring. So it ends at that cut, and each run of edges is complete.\n let run: Position[] = [];\n for (let steps = 1; steps <= count; steps++) {\n const edge = (first + steps) % count;\n const from = ring[edge];\n const to = ring[edge + 1];\n if (cut[edge] === true || from === undefined || to === undefined) {\n add(run);\n run = [];\n continue;\n }\n if (run.length === 0) run.push(from);\n run.push(to);\n }\n }\n }\n return lines;\n}\n\n/**\n * This function gives the lines of a grid of meridians and parallels. Each line is a list of longitudes and latitudes, in degrees: two numbers for each point.\n *\n * `spacing` is the angle between two lines, in degrees, and `step` is the largest step of a line. A spacing of 0 or less gives no lines.\n * The meridians at each 90 degrees go to the poles. The other meridians stop one spacing before each pole, so the poles stay clear.\n */\nexport function gridLines(spacing: number, step: number): Float64Array[] {\n if (!(spacing > 0) || !(step > 0) || !Number.isFinite(spacing)) return [];\n const lines: Float64Array[] = [];\n const add = (fromLon: number, fromLat: number, toLon: number, toLat: number): void => {\n const parts = Math.max(Math.ceil(Math.max(Math.abs(toLon - fromLon), Math.abs(toLat - fromLat)) / step), 1);\n const line = new Float64Array((parts + 1) * 2);\n for (let part = 0; part <= parts; part++) {\n line[part * 2] = fromLon + ((toLon - fromLon) * part) / parts;\n line[part * 2 + 1] = fromLat + ((toLat - fromLat) * part) / parts;\n }\n lines.push(line);\n };\n const top = (Math.ceil(90 / spacing) - 1) * spacing;\n for (let index = 0; index * spacing < 360 - ON_LINE; index++) {\n const lon = -180 + index * spacing;\n const quarter = Math.abs(lon / 90 - Math.round(lon / 90)) <= ON_LINE;\n const end = quarter ? 90 : top;\n if (end > 0) add(lon, -end, lon, end);\n }\n for (let lat = -top; lat <= top + ON_LINE; lat += spacing) add(-180, lat, 180, lat);\n return lines;\n}\n","import { fromUnitVector, toUnitVector, type LatLon, type Region } from \"@mark1russell7/geo\";\nimport type { Point3 } from \"@mark1russell7/layout-contract\";\nimport { ballView, capView, FIT_MARGIN, type StageView } from \"../extent.ts\";\nimport type { ViewAngles } from \"../view.ts\";\n\n/**\n * The polar limits of the camera of a globe: the camera goes above each pole.\n * Give this value to the option `polar` of a stage. Set the option `pan` to false, so the camera turns around the center of the Earth.\n */\nexport const GLOBE_POLAR: { readonly min: number; readonly max: number } = { min: 0.01, max: Math.PI - 0.01 };\n\nconst RADIANS = Math.PI / 180;\n\n/**\n * This function gives the point of a globe for a place on the Earth. The center of the globe is the origin of the stage.\n *\n * The axis `y` of the stage goes to the north pole. The axis `z` goes to latitude 0 and longitude 0, and the axis `x` goes to latitude 0 and longitude 90 east.\n * `radius` is the distance of the point from the center. The default is 1.\n */\nexport function globePoint(place: LatLon, radius: number = 1): Point3 {\n const unit = toUnitVector(place);\n return { x: unit.y * radius, y: unit.z * radius, z: unit.x * radius };\n}\n\n/**\n * This function gives the place on the Earth in the direction of a point of the stage, as seen from the center of the globe.\n * The center of the globe has no direction, so it gives `undefined`.\n */\nexport function globePlace(point: Point3): LatLon | undefined {\n if (point.x === 0 && point.y === 0 && point.z === 0) return undefined;\n if (!Number.isFinite(point.x) || !Number.isFinite(point.y) || !Number.isFinite(point.z)) return undefined;\n return fromUnitVector({ x: point.z, y: point.x, z: point.y });\n}\n\n/** This function gives the direction of a camera that is above a place on the Earth. */\nexport function globeAngles(place: LatLon): ViewAngles {\n return { polar: Math.PI / 2 - place.lat * RADIANS, azimuth: place.lon * RADIANS };\n}\n\n/**\n * This function makes a view from above a place on the Earth. The picture shows the cap of the Earth around the place.\n *\n * `degrees` is the angle of the cap at the center of the Earth. It is the distance from the place to the edge of the cap, in degrees of a great circle.\n * The default is 90: the picture shows a half of the Earth. `margin` is the space around the cap, as a factor of the height above the surface.\n */\nexport function globeView(place: LatLon, degrees: number = 90, margin: number = FIT_MARGIN): StageView {\n return capView(globeAngles(place), Math.min(Math.max(degrees, 0), 90) * RADIANS, margin);\n}\n\n/**\n * This function makes a view that shows each region of a list. The camera is above the middle of the regions.\n * The regions fill the width or the height of the picture, so a wide region is large in a wide picture.\n * A list with no regions gives a view of a half of the Earth. `margin` is the space around the regions, as a factor of the height above the surface.\n */\nexport function regionView(regions: readonly Region[], margin: number = FIT_MARGIN): StageView {\n const points: Point3[] = [];\n for (const region of regions) {\n const polygons = region.type === \"Polygon\" ? [region.coordinates] : region.coordinates;\n for (const polygon of polygons) {\n // The first ring of a polygon is its outer edge. A hole is in it, so the holes add no extent.\n for (const position of polygon[0] ?? []) points.push(globePoint({ lat: position[1], lon: position[0] }));\n }\n }\n return ballView(points, margin);\n}\n\n/**\n * This function gives the first point of a ball that a ray finds. The center of the ball is the origin of the stage.\n *\n * `direction` has the length 1. A ray that does not find the ball gives `undefined`, and a ray that starts in the ball also gives `undefined`.\n */\nexport function rayBall(origin: Point3, direction: Point3, radius: number): Point3 | undefined {\n const along = origin.x * direction.x + origin.y * direction.y + origin.z * direction.z;\n const outside = origin.x * origin.x + origin.y * origin.y + origin.z * origin.z - radius * radius;\n if (!(outside > 0)) return undefined;\n const root = along * along - outside;\n if (!(root >= 0)) return undefined;\n const distance = -along - Math.sqrt(root);\n if (!(distance >= 0)) return undefined;\n return { x: origin.x + direction.x * distance, y: origin.y + direction.y * distance, z: origin.z + direction.z * distance };\n}\n\n/**\n * This function tells if a camera at `eye` sees a point of the surface of a ball. The center of the ball is the origin of the stage.\n * A point on the far side of the ball gives false.\n */\nexport function inSight(point: Point3, eye: Point3, radius: number): boolean {\n const length = Math.hypot(point.x, point.y, point.z);\n if (!(length > 0)) return false;\n return (point.x * eye.x + point.y * eye.y + point.z * eye.z) / length > radius;\n}\n","import { pointLocator, type LatLon, type PointLocator, type Region } from \"@mark1russell7/geo\";\nimport type { Point3 } from \"@mark1russell7/layout-contract\";\nimport {\n BufferAttribute,\n BufferGeometry,\n Color,\n FrontSide,\n InstancedInterleavedBuffer,\n InterleavedBufferAttribute,\n Mesh,\n MeshBasicMaterial,\n Points,\n ShaderMaterial,\n Sphere,\n SphereGeometry,\n Vector3,\n type Object3D,\n type Raycaster,\n} from \"three\";\nimport { LineMaterial } from \"three/addons/lines/LineMaterial.js\";\nimport { LineSegments2 } from \"three/addons/lines/LineSegments2.js\";\nimport { LineSegmentsGeometry } from \"three/addons/lines/LineSegmentsGeometry.js\";\nimport type { Highlight } from \"../highlight.ts\";\nimport type { StageContent, StageFrame, StagePick } from \"../stage/stage.ts\";\nimport type { StageTheme } from \"../theme.ts\";\nimport { gridLines, regionEdges, regionSurface, surfaceSag } from \"./mesh.ts\";\nimport { globePlace, globePoint, inSight, rayBall } from \"./space.ts\";\n\n/** The look of the areas and the points of one kind. Each color is a CSS hex color. */\nexport interface GlobeStyle {\n /** The color of the surface of an area, or of a point. An area with no color has no surface, and a point with no color is not in the picture. */\n readonly fill?: string | undefined;\n /** The part of the light that the surface of an area stops, from 0 to 1. The default is 1. */\n readonly opacity?: number | undefined;\n /** The color of the edge of an area, or of the ring around a point. An area with no color has no edge. */\n readonly line?: string | undefined;\n}\n\n/** The colors of a globe. Each color is a CSS hex color. */\nexport interface GlobeTheme extends StageTheme {\n /** The color of the Earth where it has no area, for example the sea. */\n readonly ball: string;\n /** The color of the meridians and the parallels. */\n readonly grid: string;\n /** The color of the shade at the rim of the Earth. */\n readonly shade: string;\n /** The style of each kind of area or point, by the name of the kind. */\n readonly styles: Readonly<Record<string, GlobeStyle>>;\n /** The style of a kind that `styles` does not have. */\n readonly other: GlobeStyle;\n /** The color of the edge of a record under the pointer, or in the highlighted list. */\n readonly hovered: string;\n /** The color of the edge of the selected record. */\n readonly selected: string;\n}\n\n/** An area of a globe: a region of the Earth that belongs to a record. */\nexport interface GlobeArea<P> {\n /** The name of the record. Two parts with one name are one record: the stage highlights them together. */\n readonly record: string;\n /** The region, with edges that are straight lines in longitude and latitude, as in `@mark1russell7/geo`. */\n readonly region: Region;\n /** The name of the style of the area in the theme. */\n readonly kind: string;\n /** The value that a pick of the area gives to the page. */\n readonly value: P;\n /** This value is false for an area that the pointer does not find. The default is true. */\n readonly pick?: boolean | undefined;\n}\n\n/** A point of a globe: a place on the Earth that belongs to a record. The picture shows it as a dot of a constant size. */\nexport interface GlobePoint<P> {\n /** The name of the record. Two parts with one name are one record: the stage highlights them together. */\n readonly record: string;\n readonly place: LatLon;\n /** The name of the style of the point in the theme. */\n readonly kind: string;\n /** The value that a pick of the point gives to the page. */\n readonly value: P;\n /** The width of the dot, in CSS pixels. The default is the option `pointSize` of the globe. */\n readonly size?: number | undefined;\n /** This value is false for a point that the pointer does not find. The default is true. */\n readonly pick?: boolean | undefined;\n}\n\n/** The options of a globe. Each width is in CSS pixels. */\nexport interface GlobeOptions<P> {\n /** The areas, in the sequence of the picture: a later area is above an earlier area, and the pointer finds it first. */\n readonly areas?: readonly GlobeArea<P>[] | undefined;\n /** The points. Each point is above each area. */\n readonly points?: readonly GlobePoint<P>[] | undefined;\n /** The radius of the globe, in the units of the stage. The default is 1. */\n readonly radius?: number | undefined;\n /** The largest step of an edge in longitude or latitude, in degrees. A smaller step follows the curve of the Earth better. The default is 1. */\n readonly step?: number | undefined;\n /** The angle between two lines of the grid, in degrees. The value 0 gives no grid. The default is 15. */\n readonly grid?: number | undefined;\n /** The smallest height of the camera above the surface, as a part of the radius. The default is 0.005. */\n readonly nearest?: number | undefined;\n /** The width of the edge of an area. The default is 1.25. */\n readonly lineWidth?: number | undefined;\n /** The width of the edge of a record with a highlight. The default is 2.5. */\n readonly highlightWidth?: number | undefined;\n /** The width of a line of the grid. The default is 1. */\n readonly gridWidth?: number | undefined;\n /** The width of the dot of a point. The default is 9. */\n readonly pointSize?: number | undefined;\n /** The strength of the shade at the rim of the Earth, from 0 to 1. The default is 0.4. */\n readonly shade?: number | undefined;\n}\n\n/** The content of a stage that shows the Earth as a globe, with areas and points on it. */\nexport interface GlobeContent<P> extends StageContent<P, GlobeTheme> {\n /**\n * This function shows only the areas and the points that a test accepts. A part that the picture does not show gets no pick.\n * Start `refresh` of the stage after it. A test that accepts each part shows all of them again.\n */\n show(test: (part: GlobeArea<P> | GlobePoint<P>) => boolean): void;\n /** This function gives the place on the Earth that a ray from the camera finds. A ray that does not find the Earth gives `undefined`. */\n placeAt(ray: Raycaster): LatLon | undefined;\n}\n\n/** The smallest height of the layer of the areas above the ball, as a part of the radius. */\nconst MIN_LIFT = 0.0005;\n\n/** The opacity that a highlight adds to the surface of an area. */\nconst HIGHLIGHT_OPACITY = 0.16;\n\n/** The factor of the width of a point with a highlight. */\nconst HIGHLIGHT_SIZE = 1.35;\n\n/** The width of the ring around a point, in CSS pixels. */\nconst RING_WIDTH = 1.5;\n\n/**\n * This function gives the radius of the mark of a point of a globe, in CSS pixels. The mark is the dot, and the ring around it.\n * `size` is the width of the dot. Give the result to the field `clear` of a label, so the text stays off the mark.\n */\nexport function pointRadius(size: number): number {\n return size / 2 + RING_WIDTH;\n}\n\n/** The distance around a point where the pointer finds it, in CSS pixels. */\nconst PICK_MARGIN = 4;\n\n/** The exponent of the shade at the rim. A large value keeps the shade near the rim. */\nconst SHADE_POWER = 2.6;\n\nconst BALL_SEGMENTS = 128;\n\nconst SHADE_VERTEX = `\nvarying vec3 vNormal;\nvarying vec3 vToEye;\nvoid main() {\n vec4 inView = modelViewMatrix * vec4(position, 1.0);\n vNormal = normalMatrix * normal;\n vToEye = -inView.xyz;\n gl_Position = projectionMatrix * inView;\n}`;\n\nconst SHADE_FRAGMENT = `\nuniform vec3 shade;\nuniform float strength;\nuniform float power;\nvarying vec3 vNormal;\nvarying vec3 vToEye;\nvoid main() {\n float facing = clamp(dot(normalize(vNormal), normalize(vToEye)), 0.0, 1.0);\n gl_FragColor = vec4(shade, strength * pow(1.0 - facing, power));\n #include <colorspace_fragment>\n}`;\n\nconst POINT_VERTEX = `\nuniform float pixelRatio;\nuniform float ringWidth;\nattribute vec3 fill;\nattribute vec3 ring;\nattribute float size;\nvarying vec3 vFill;\nvarying vec3 vRing;\nvarying float vFade;\nvarying float vInner;\nvoid main() {\n vec4 inWorld = modelMatrix * vec4(position, 1.0);\n vec3 up = normalize(inWorld.xyz - modelMatrix[3].xyz);\n float facing = dot(up, normalize(cameraPosition - inWorld.xyz));\n vFill = fill;\n vRing = ring;\n vFade = smoothstep(0.0, 0.1, facing);\n vInner = size / (size + 2.0 * ringWidth);\n gl_PointSize = (size + 2.0 * ringWidth) * pixelRatio;\n gl_Position = projectionMatrix * viewMatrix * inWorld;\n // A point on the far side of the Earth, and a point that the picture does not show, goes out of the picture.\n if (facing <= 0.0 || size <= 0.0) gl_Position = vec4(2.0, 2.0, 2.0, 1.0);\n}`;\n\nconst POINT_FRAGMENT = `\nvarying vec3 vFill;\nvarying vec3 vRing;\nvarying float vFade;\nvarying float vInner;\nvoid main() {\n float distance = length(gl_PointCoord * 2.0 - 1.0);\n float soft = fwidth(distance);\n float dot = 1.0 - smoothstep(1.0 - soft, 1.0, distance);\n float middle = 1.0 - smoothstep(vInner - soft, vInner, distance);\n gl_FragColor = vec4(mix(vRing, vFill, middle), dot * vFade);\n if (gl_FragColor.a <= 0.0) discard;\n #include <colorspace_fragment>\n}`;\n\n/** An area with the place of its data in the buffers of the globe. */\ninterface AreaPart<P> {\n readonly area: GlobeArea<P>;\n readonly locate: PointLocator | undefined;\n readonly firstCorner: number;\n readonly cornerCount: number;\n readonly firstIndex: number;\n readonly indexCount: number;\n readonly firstSegment: number;\n readonly segmentCount: number;\n shown: boolean;\n filled: boolean;\n lined: boolean;\n highlight: Highlight;\n}\n\n/** A point with its place on the globe. */\ninterface PointPart<P> {\n readonly point: GlobePoint<P>;\n readonly at: Point3;\n readonly size: number;\n shown: boolean;\n filled: boolean;\n highlight: Highlight;\n}\n\n/** This function gives the text of a thrown value. */\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/** This function writes the points of lines into a list of segments on a ball: six numbers for each segment. It gives the count of the segments. */\nfunction addSegments(lines: readonly Float64Array[], radius: number, to: number[]): number {\n let count = 0;\n for (const line of lines) {\n let from: Point3 | undefined;\n for (let index = 0; index + 1 < line.length; index += 2) {\n const next = globePoint({ lat: line[index + 1] ?? 0, lon: line[index] ?? 0 }, radius);\n if (from !== undefined) {\n to.push(from.x, from.y, from.z, next.x, next.y, next.z);\n count += 1;\n }\n from = next;\n }\n }\n return count;\n}\n\n/** This function makes the geometry of thick line segments from a buffer of positions and a buffer of colors: six numbers for each segment. */\nfunction segmentGeometry(positions: InstancedInterleavedBuffer, colors: InstancedInterleavedBuffer | undefined, count: number, bounds: Sphere): LineSegmentsGeometry {\n const geometry = new LineSegmentsGeometry();\n geometry.setAttribute(\"instanceStart\", new InterleavedBufferAttribute(positions, 3, 0));\n geometry.setAttribute(\"instanceEnd\", new InterleavedBufferAttribute(positions, 3, 3));\n if (colors !== undefined) {\n geometry.setAttribute(\"instanceColorStart\", new InterleavedBufferAttribute(colors, 3, 0));\n geometry.setAttribute(\"instanceColorEnd\", new InterleavedBufferAttribute(colors, 3, 3));\n }\n geometry.instanceCount = count;\n geometry.boundingSphere = bounds;\n return geometry;\n}\n\n/**\n * This function makes the content of a stage that shows the Earth as a globe. The center of the globe is the origin of the stage.\n *\n * The materials use no light, so each color in the picture is the color of the theme. Use `GLOBE_POLAR` and no pan in the options of the stage.\n * The function throws an `Error` with the name of the record for an area that is not correct. Its cause is the error of `@mark1russell7/geo`.\n */\nexport function createGlobe<P>(options: GlobeOptions<P> = {}): GlobeContent<P> {\n const radius = options.radius ?? 1;\n const step = options.step ?? 1;\n const layer = radius * (1 + Math.max(MIN_LIFT, surfaceSag(step) * 2));\n const bounds = new Sphere(new Vector3(0, 0, 0), layer);\n const color = new Color();\n\n // The ball, and the shade at its rim.\n const ballGeometry = new SphereGeometry(radius, BALL_SEGMENTS, BALL_SEGMENTS / 2);\n const ballMaterial = new MeshBasicMaterial();\n const ball = new Mesh(ballGeometry, ballMaterial);\n const shadeColor = { value: new Color() };\n const shadeMaterial = new ShaderMaterial({\n uniforms: { shade: shadeColor, strength: { value: Math.min(Math.max(options.shade ?? 0.4, 0), 1) }, power: { value: SHADE_POWER } },\n vertexShader: SHADE_VERTEX,\n fragmentShader: SHADE_FRAGMENT,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n side: FrontSide,\n });\n const shade = new Mesh(ballGeometry, shadeMaterial);\n shade.renderOrder = 4;\n\n // The grid.\n const gridList: number[] = [];\n const gridCount = addSegments(gridLines(options.grid ?? 15, step), layer, gridList);\n const gridMaterial = new LineMaterial({ linewidth: options.gridWidth ?? 1, transparent: true, depthWrite: false });\n const grid = new LineSegments2(segmentGeometry(new InstancedInterleavedBuffer(Float32Array.from(gridList), 6, 1), undefined, gridCount, bounds), gridMaterial);\n grid.renderOrder = 1;\n grid.visible = gridCount > 0;\n grid.frustumCulled = false;\n\n // The areas: one surface and one list of segments for all of them.\n const surfaces: { readonly corners: Float64Array; readonly triangles: Uint32Array }[] = [];\n const segmentList: number[] = [];\n const areaParts: AreaPart<P>[] = [];\n let cornerTotal = 0;\n let indexTotal = 0;\n let segmentTotal = 0;\n for (const area of options.areas ?? []) {\n try {\n const surface = regionSurface(area.region, step);\n const segmentCount = addSegments(regionEdges(area.region, step), layer, segmentList);\n areaParts.push({\n area,\n locate: area.pick === false ? undefined : pointLocator(area.region),\n firstCorner: cornerTotal,\n cornerCount: surface.corners.length / 2,\n firstIndex: indexTotal,\n indexCount: surface.triangles.length,\n firstSegment: segmentTotal,\n segmentCount,\n shown: true,\n filled: false,\n lined: false,\n highlight: 0,\n });\n surfaces.push(surface);\n cornerTotal += surface.corners.length / 2;\n indexTotal += surface.triangles.length;\n segmentTotal += segmentCount;\n } catch (error) {\n throw new Error(`The area of the record ${area.record} is not correct: ${messageOf(error)}`, { cause: error });\n }\n }\n const fillPositions = new Float32Array(cornerTotal * 3);\n const allIndices = new Uint32Array(indexTotal);\n surfaces.forEach((surface, index) => {\n const part = areaParts[index];\n if (part === undefined) return;\n for (let corner = 0; corner < part.cornerCount; corner++) {\n const point = globePoint({ lat: surface.corners[corner * 2 + 1] ?? 0, lon: surface.corners[corner * 2] ?? 0 }, layer);\n fillPositions.set([point.x, point.y, point.z], (part.firstCorner + corner) * 3);\n }\n for (let at = 0; at < part.indexCount; at++) allIndices[part.firstIndex + at] = (surface.triangles[at] ?? 0) + part.firstCorner;\n });\n const fillColors = new BufferAttribute(new Float32Array(cornerTotal * 4), 4);\n const fillIndices = new BufferAttribute(new Uint32Array(indexTotal), 1);\n const fillGeometry = new BufferGeometry();\n fillGeometry.setAttribute(\"position\", new BufferAttribute(fillPositions, 3));\n fillGeometry.setAttribute(\"color\", fillColors);\n fillGeometry.setIndex(fillIndices);\n fillGeometry.boundingSphere = bounds;\n const fillMaterial = new MeshBasicMaterial({ vertexColors: true, transparent: true, depthWrite: false, side: FrontSide });\n const fills = new Mesh(fillGeometry, fillMaterial);\n fills.renderOrder = 2;\n fills.frustumCulled = false;\n\n // The edges of the areas. The picture draws the segments at the start of the buffers, so the segments of the shown areas are there.\n const allSegments = Float32Array.from(segmentList);\n const allSegmentColors = new Float32Array(allSegments.length);\n const edgePositions = new InstancedInterleavedBuffer(new Float32Array(allSegments.length), 6, 1);\n const edgeColors = new InstancedInterleavedBuffer(new Float32Array(allSegments.length), 6, 1);\n const edgeGeometry = segmentGeometry(edgePositions, edgeColors, 0, bounds);\n const edgeMaterial = new LineMaterial({ linewidth: options.lineWidth ?? 1.25, vertexColors: true, transparent: true, depthWrite: false });\n const edges = new LineSegments2(edgeGeometry, edgeMaterial);\n edges.renderOrder = 3;\n edges.frustumCulled = false;\n\n // The edges of the records with a highlight, above the other edges.\n const highlightMaterial = new LineMaterial({ linewidth: options.highlightWidth ?? 2.5, vertexColors: true, transparent: true, depthWrite: false });\n const highlighted = new LineSegments2(new LineSegmentsGeometry(), highlightMaterial);\n highlighted.renderOrder = 5;\n highlighted.frustumCulled = false;\n highlighted.visible = false;\n\n // The points.\n const pointSize = options.pointSize ?? 9;\n const pointParts: PointPart<P>[] = (options.points ?? []).map((point) => ({\n point,\n at: globePoint(point.place, layer),\n size: point.size ?? pointSize,\n shown: true,\n filled: false,\n highlight: 0,\n }));\n const pointPositions = new Float32Array(pointParts.length * 3);\n pointParts.forEach((part, index) => pointPositions.set([part.at.x, part.at.y, part.at.z], index * 3));\n const pointFills = new BufferAttribute(new Float32Array(pointParts.length * 3), 3);\n const pointRings = new BufferAttribute(new Float32Array(pointParts.length * 3), 3);\n const pointSizes = new BufferAttribute(new Float32Array(pointParts.length), 1);\n const pointGeometry = new BufferGeometry();\n pointGeometry.setAttribute(\"position\", new BufferAttribute(pointPositions, 3));\n pointGeometry.setAttribute(\"fill\", pointFills);\n pointGeometry.setAttribute(\"ring\", pointRings);\n pointGeometry.setAttribute(\"size\", pointSizes);\n pointGeometry.boundingSphere = bounds;\n const pixelRatio = { value: 1 };\n const pointMaterial = new ShaderMaterial({\n uniforms: { pixelRatio, ringWidth: { value: RING_WIDTH } },\n vertexShader: POINT_VERTEX,\n fragmentShader: POINT_FRAGMENT,\n transparent: true,\n depthTest: false,\n depthWrite: false,\n });\n const dots = new Points(pointGeometry, pointMaterial);\n dots.renderOrder = 6;\n dots.frustumCulled = false;\n dots.visible = pointParts.length > 0;\n // The size of a dot is in CSS pixels, and the picture can have more than one pixel for each CSS pixel.\n dots.onBeforeRender = (renderer): void => {\n pixelRatio.value = renderer.getPixelRatio();\n };\n\n const records = new Set<string>([...areaParts.map((part) => part.area.record), ...pointParts.map((part) => part.point.record)]);\n let painted: GlobeTheme | undefined;\n /** The angle of one CSS pixel at the middle of the picture, in radians. */\n let pixelAngle = 0.001;\n\n const styleOf = (theme: GlobeTheme, kind: string): GlobeStyle => theme.styles[kind] ?? theme.other;\n const highlightColor = (theme: GlobeTheme, highlight: Highlight): string => (highlight === 2 ? theme.selected : theme.hovered);\n\n /** This function writes the colors of an area into the buffers. */\n const paintArea = (part: AreaPart<P>, theme: GlobeTheme): void => {\n const style = styleOf(theme, part.area.kind);\n part.filled = style.fill !== undefined;\n part.lined = style.line !== undefined;\n if (style.fill !== undefined) {\n color.set(style.fill);\n const opacity = Math.min(Math.max(style.opacity ?? 1, 0), 1);\n const alpha = part.highlight === 0 ? opacity : Math.min(opacity + HIGHLIGHT_OPACITY, 1);\n const values = [color.r, color.g, color.b, alpha];\n for (let corner = 0; corner < part.cornerCount; corner++) fillColors.array.set(values, (part.firstCorner + corner) * 4);\n fillColors.needsUpdate = true;\n }\n if (style.line !== undefined) {\n color.set(style.line);\n const values = [color.r, color.g, color.b, color.r, color.g, color.b];\n for (let segment = 0; segment < part.segmentCount; segment++) allSegmentColors.set(values, (part.firstSegment + segment) * 6);\n }\n };\n\n /** This function puts the data of the shown parts at the start of the buffers that the picture draws. */\n const sync = (theme: GlobeTheme): void => {\n let indexCount = 0;\n let segmentCount = 0;\n let highlightCount = 0;\n for (const part of areaParts) {\n if (!part.shown) continue;\n if (part.filled) {\n fillIndices.array.set(allIndices.subarray(part.firstIndex, part.firstIndex + part.indexCount), indexCount);\n indexCount += part.indexCount;\n }\n if (part.lined) {\n const from = part.firstSegment * 6;\n const to = from + part.segmentCount * 6;\n edgePositions.array.set(allSegments.subarray(from, to), segmentCount * 6);\n edgeColors.array.set(allSegmentColors.subarray(from, to), segmentCount * 6);\n segmentCount += part.segmentCount;\n }\n if (part.highlight !== 0) highlightCount += part.segmentCount;\n }\n fillIndices.needsUpdate = true;\n fillGeometry.setDrawRange(0, indexCount);\n fills.visible = indexCount > 0;\n edgePositions.needsUpdate = true;\n edgeColors.needsUpdate = true;\n edgeGeometry.instanceCount = segmentCount;\n edges.visible = segmentCount > 0;\n\n // The edges of the records with a highlight get a new geometry. They are few, and a record changes its highlight only on an act of a person.\n const highlightPositions = new Float32Array(highlightCount * 6);\n const highlightColors = new Float32Array(highlightCount * 6);\n let at = 0;\n for (const part of areaParts) {\n if (!part.shown || part.highlight === 0) continue;\n color.set(highlightColor(theme, part.highlight));\n const values = [color.r, color.g, color.b, color.r, color.g, color.b];\n highlightPositions.set(allSegments.subarray(part.firstSegment * 6, (part.firstSegment + part.segmentCount) * 6), at * 6);\n for (let segment = 0; segment < part.segmentCount; segment++) highlightColors.set(values, (at + segment) * 6);\n at += part.segmentCount;\n }\n highlighted.geometry.dispose();\n highlighted.geometry =\n highlightCount > 0 ? segmentGeometry(new InstancedInterleavedBuffer(highlightPositions, 6, 1), new InstancedInterleavedBuffer(highlightColors, 6, 1), highlightCount, bounds) : new LineSegmentsGeometry();\n highlighted.visible = highlightCount > 0;\n\n pointParts.forEach((part, index) => {\n const style = styleOf(theme, part.point.kind);\n part.filled = style.fill !== undefined;\n const visible = part.shown && style.fill !== undefined;\n pointSizes.array[index] = visible ? part.size * (part.highlight === 0 ? 1 : HIGHLIGHT_SIZE) : 0;\n if (style.fill === undefined) return;\n color.set(style.fill);\n pointFills.array.set([color.r, color.g, color.b], index * 3);\n color.set(part.highlight === 0 ? (style.line ?? style.fill) : highlightColor(theme, part.highlight));\n pointRings.array.set([color.r, color.g, color.b], index * 3);\n });\n pointSizes.needsUpdate = true;\n pointFills.needsUpdate = true;\n pointRings.needsUpdate = true;\n };\n\n return {\n objects: [ball, grid, fills, edges, shade, highlighted, dots] satisfies Object3D[],\n extent: { center: { x: 0, y: 0, z: 0 }, corners: [], surface: radius, minDistance: radius * (1 + Math.max(options.nearest ?? 0.005, 1e-6)) },\n has: (record) => records.has(record),\n pick(ray): StagePick<P> | undefined {\n const { origin, direction } = ray.ray;\n let found: PointPart<P> | undefined;\n let nearest = Infinity;\n for (const part of pointParts) {\n if (!part.shown || !part.filled || part.point.pick === false || !inSight(part.at, origin, radius)) continue;\n const x = part.at.x - origin.x;\n const y = part.at.y - origin.y;\n const z = part.at.z - origin.z;\n const cosine = (x * direction.x + y * direction.y + z * direction.z) / Math.hypot(x, y, z);\n const angle = Math.acos(Math.min(Math.max(cosine, -1), 1));\n if (angle > (part.size / 2 + PICK_MARGIN) * pixelAngle || angle >= nearest) continue;\n found = part;\n nearest = angle;\n }\n if (found !== undefined) return { record: found.point.record, value: found.point.value };\n const hit = rayBall(origin, direction, radius);\n const place = hit === undefined ? undefined : globePlace(hit);\n if (place === undefined) return undefined;\n for (let index = areaParts.length - 1; index >= 0; index--) {\n const part = areaParts[index];\n if (part === undefined || !part.shown || part.locate === undefined || !(part.filled || part.lined)) continue;\n if (part.locate(place) !== \"outside\") return { record: part.area.record, value: part.area.value };\n }\n return undefined;\n },\n paint(theme, highlight): void {\n const all = theme !== painted;\n painted = theme;\n if (all) {\n ballMaterial.color.set(theme.ball);\n gridMaterial.color.set(theme.grid);\n shadeColor.value.set(theme.shade);\n }\n for (const part of areaParts) {\n const next = highlight(part.area.record);\n if (!all && next === part.highlight) continue;\n part.highlight = next;\n paintArea(part, theme);\n }\n for (const part of pointParts) part.highlight = highlight(part.point.record);\n sync(theme);\n },\n step(frame: StageFrame): boolean {\n pixelAngle = (2 * Math.tan((frame.fieldOfView * Math.PI) / 360)) / Math.max(frame.height, 1);\n return false;\n },\n show(test): void {\n for (const part of areaParts) part.shown = test(part.area);\n for (const part of pointParts) part.shown = test(part.point);\n if (painted !== undefined) sync(painted);\n },\n placeAt(ray): LatLon | undefined {\n const hit = rayBall(ray.ray.origin, ray.ray.direction, radius);\n return hit === undefined ? undefined : globePlace(hit);\n },\n dispose(): void {\n ballGeometry.dispose();\n ballMaterial.dispose();\n shadeMaterial.dispose();\n grid.geometry.dispose();\n gridMaterial.dispose();\n fillGeometry.dispose();\n fillMaterial.dispose();\n edgeGeometry.dispose();\n edgeMaterial.dispose();\n highlighted.geometry.dispose();\n highlightMaterial.dispose();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AAK,MAAM;IACvC,IAAI,CAAC,OAAO,SAAS,KAAK,WAAW;IACrC,KAAK,YAAY;IACjB,UAAU,MAAM,KAAK;GACvB;GACA,KAAK,MAAM,QAAQ,YAAY,KAAK,YAAY,UAAU,KAAK,MAAM,MAAM;GAC3E,KAAK,KAAK;EACZ;EACA,KAAK,OAA4B;GAC/B,aAAc,IAAI,KAAK,IAAK,MAAM,cAAc,KAAK,KAAM,GAAG,IAAK,KAAK,IAAI,MAAM,QAAQ,CAAC;GAC3F,OAAO;EACT;EACA,KAAK,MAAY;GACf,KAAK,MAAM,QAAQ,WAAW,KAAK,QAAQ,KAAK,KAAK,IAAI;GACzD,KAAK,MAAM,QAAQ,YAAY,KAAK,QAAQ,KAAK,KAAK,KAAK;GAC3D,IAAI,YAAY,KAAA,GAAW,KAAK,OAAO;EACzC;EACA,QAAQ,KAAyB;GAC/B,MAAM,MAAM,QAAQ,IAAI,IAAI,QAAQ,IAAI,IAAI,WAAW,MAAM;GAC7D,OAAO,QAAQ,KAAA,IAAY,KAAA,IAAY,WAAW,GAAG;EACvD;EACA,UAAgB;GACd,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,cAAc,QAAQ;GACtB,KAAK,SAAS,QAAQ;GACtB,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,YAAY,SAAS,QAAQ;GAC7B,kBAAkB,QAAQ;GAC1B,cAAc,QAAQ;GACtB,cAAc,QAAQ;EACxB;CACF;AACF"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as speedAt, C as ViewAngles, D as clampPlace, E as capDistance, M as turnBetween, N as viewAxes, O as fitDistance, P as viewOf, S as PlaceLimits, T as cameraPosition, _ as reachOf, a as NO_HIGHLIGHTS, b as FIELD_OF_VIEW, c as FIT_MARGIN, d as StageView, f as ViewFrame, g as nearDepth, h as fitView, i as Highlights, j as turnAcross, k as placeBetween, l as StageExtent, m as capView, n as CLICK_DISTANCE, o as highlightOf, p as ballView, r as Highlight, s as isClick, t as StageTheme, u as StageLimits, v as stageLimits, w as ViewAxes, x as Place, y as surfaceOf } from "./theme-3EGbXXoP.js";
|
|
2
2
|
import { C as spanPart, S as spanOfTimes, _ as replayPause, a as REPLAY_STEP, b as replaySpan, c as changeAfter, d as changeTimes, f as isLive, g as replayOf, h as replayNextSpeed, i as REPLAY_SPEEDS, l as changeBefore, m as replayKey, n as REPLAY_DURATION, o as Replay, p as replayAdvance, r as REPLAY_PAGE, s as TimeSpan, t as Lifetime, u as changeIndex, v as replayPlay, w as spanTime, x as replayToggle, y as replaySeek } from "./replay-DvGYPe7T.js";
|
|
3
3
|
import { Point, Point3 } from "@mark1russell7/layout-contract";
|
|
4
|
-
/** The angle of one step of an arrow key, in radians
|
|
4
|
+
/** The largest angle of one step of an arrow key, in radians. A camera far from a ball, or with no ball, turns by this angle. */
|
|
5
5
|
export declare const KEY_TURN: number;
|
|
6
|
+
/** The part of the height of the picture by which one step of an arrow key moves the surface of a ball, near the ball. */
|
|
7
|
+
export declare const KEY_PART = .125;
|
|
6
8
|
/** The factor of the height of a camera above the surface for one step of the key `+`. */
|
|
7
9
|
export declare const KEY_ZOOM = .85;
|
|
8
10
|
/** What a key does on a stage: it moves the camera to a place, or it shows a view. */
|
|
@@ -21,12 +23,15 @@ interface KeyOptions {
|
|
|
21
23
|
readonly views?: Readonly<Record<string, string>> | undefined;
|
|
22
24
|
/** The radius of the ball around the target that the camera stays out of, or 0 for no ball. */
|
|
23
25
|
readonly surface?: number | undefined;
|
|
26
|
+
/** The vertical angle of the picture, in degrees. The default is `FIELD_OF_VIEW`. */
|
|
27
|
+
readonly fieldOfView?: number | undefined;
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* This function gives the action of a key on a stage, or `undefined` for a key with no action.
|
|
27
31
|
*
|
|
28
32
|
* The arrow keys turn the camera around the target. The keys `+` and `-` change the height above the surface.
|
|
29
|
-
* The keys `Home` and `0` show the home view.
|
|
33
|
+
* The keys `Home` and `0` show the home view.
|
|
34
|
+
* Near a ball, a step of an arrow key moves the surface by the part `KEY_PART` of the height of the picture.
|
|
30
35
|
* The result has no limits: the stage puts the place in its limits.
|
|
31
36
|
*/
|
|
32
37
|
export declare function keyAction(key: string, now: Place, options: KeyOptions): KeyAction | undefined;
|
|
@@ -72,5 +77,15 @@ export declare function approach(value: number, goal: number, seconds: number, t
|
|
|
72
77
|
* - A point to the side of the picture gives a position out of the picture. The function does not remove it.
|
|
73
78
|
*/
|
|
74
79
|
export declare function screenPoint(point: Point3, view: ArrayLike<number>, projection: ArrayLike<number>, width: number, height: number): Point | undefined;
|
|
75
|
-
|
|
80
|
+
/**
|
|
81
|
+
* This function tells if a browser can show a stage. A stage needs WebGL 2.
|
|
82
|
+
*
|
|
83
|
+
* A page uses it before it loads the entry `/three`. Thus a browser with no WebGL 2 shows a different picture, and it does not load `three`.
|
|
84
|
+
* The function asks a canvas that is not in the page for a context, and it releases the context at once.
|
|
85
|
+
* `page` is the document of the page. The default is the document of the browser. With no document, the function gives false.
|
|
86
|
+
*
|
|
87
|
+
* A stage can give `undefined` after this function gave true, so the page keeps its different picture ready.
|
|
88
|
+
*/
|
|
89
|
+
export declare function stageSupported(page?: Document | undefined): boolean;
|
|
90
|
+
export { CLICK_DISTANCE, FIELD_OF_VIEW, FIT_MARGIN, type Highlight, type Highlights, type KeyAction, type KeyOptions, type Lifetime, type Move, type MoveStep, NO_HIGHLIGHTS, type Place, type PlaceLimits, REPLAY_DURATION, REPLAY_PAGE, REPLAY_SPEEDS, REPLAY_STEP, type Replay, type StageExtent, type StageLimits, type StageTheme, type StageView, type TimeSpan, type ViewAngles, type ViewAxes, type ViewFrame, ballView, cameraPosition, capDistance, capView, changeAfter, changeBefore, changeIndex, changeTimes, clampPlace, fitDistance, fitView, highlightOf, isClick, isLive, nearDepth, placeBetween, reachOf, replayAdvance, replayKey, replayNextSpeed, replayOf, replayPause, replayPlay, replaySeek, replaySpan, replayToggle, spanOfTimes, spanPart, spanTime, speedAt, stageLimits, surfaceOf, turnAcross, turnBetween, viewAxes, viewOf };
|
|
76
91
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/keys.ts","../src/motion.ts","../src/screen.ts"],"mappings":";;;;qBAGa;;qBAGA;;KAGD;WAAuB;WAAwB,OAAO;;WAAqB;WAAuB;;;UAG7F;;WAEN;;WAEA,QAAQ,SAAS;;WAEjB
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/keys.ts","../src/motion.ts","../src/screen.ts","../src/support.ts"],"mappings":";;;;qBAGa;;qBAGA;;qBAGA;;KAGD;WAAuB;WAAwB,OAAO;;WAAqB;WAAuB;;;UAG7F;;WAEN;;WAEA,QAAQ,SAAS;;WAEjB;;WAEA;;;;;;;;;;wBAWK,UAAU,aAAa,KAAK,OAAO,SAAS,aAAa;;UC/BxD;WACN,MAAM;WACN,IAAI;;WAEJ;;WAEA;;;UAIM;WACN,OAAO;;WAEP;;;;;;wBAOK,UAAU;;;;;wBASV,OAAO,MAAM,MAAM,aAAa,mBAAsB;;;;;;;wBAYtD,SAAS,eAAe,cAAc,iBAAiB,cAAc;;;;;;;;;;wBC5BrE,YAAY,OAAO,QAAQ,MAAM,mBAAmB,YAAY,mBAAmB,eAAe,iBAAiB;;;;;;;;;;wBCPnH,eAAe,OAAM"}
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { a as NO_HIGHLIGHTS, c as
|
|
1
|
+
import { _ as turnBetween, a as nearDepth, c as surfaceOf, d as capDistance, f as clampPlace, g as turnAcross, h as speedAt, i as fitView, l as FIELD_OF_VIEW, m as placeBetween, n as ballView, o as reachOf, p as fitDistance, r as capView, s as stageLimits, t as FIT_MARGIN, u as cameraPosition, v as viewAxes, y as viewOf } from "./extent-DC0qrxC5.js";
|
|
2
|
+
import { a as NO_HIGHLIGHTS, c as KEY_PART, d as keyAction, i as CLICK_DISTANCE, l as KEY_TURN, n as easeInOut, o as highlightOf, r as moveAt, s as isClick, t as approach, u as KEY_ZOOM } from "./motion-dvvkaDwv.js";
|
|
3
3
|
import { _ as replaySpan, a as changeAfter, b as spanPart, c as changeTimes, d as replayKey, f as replayNextSpeed, g as replaySeek, h as replayPlay, i as REPLAY_STEP, l as isLive, m as replayPause, n as REPLAY_PAGE, o as changeBefore, p as replayOf, r as REPLAY_SPEEDS, s as changeIndex, t as REPLAY_DURATION, u as replayAdvance, v as replayToggle, x as spanTime, y as spanOfTimes } from "./replay-YdWMyFko.js";
|
|
4
4
|
import { t as screenPoint } from "./screen-DeOx4_90.js";
|
|
5
|
-
|
|
5
|
+
// src/support.ts
|
|
6
|
+
/**
|
|
7
|
+
* This function tells if a browser can show a stage. A stage needs WebGL 2.
|
|
8
|
+
*
|
|
9
|
+
* A page uses it before it loads the entry `/three`. Thus a browser with no WebGL 2 shows a different picture, and it does not load `three`.
|
|
10
|
+
* The function asks a canvas that is not in the page for a context, and it releases the context at once.
|
|
11
|
+
* `page` is the document of the page. The default is the document of the browser. With no document, the function gives false.
|
|
12
|
+
*
|
|
13
|
+
* A stage can give `undefined` after this function gave true, so the page keeps its different picture ready.
|
|
14
|
+
*/
|
|
15
|
+
function stageSupported(page = globalThis.document) {
|
|
16
|
+
if (page === void 0) return false;
|
|
17
|
+
try {
|
|
18
|
+
const context = page.createElement("canvas").getContext("webgl2");
|
|
19
|
+
if (context === null) return false;
|
|
20
|
+
context.getExtension("WEBGL_lose_context")?.loseContext();
|
|
21
|
+
return true;
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export { CLICK_DISTANCE, FIELD_OF_VIEW, FIT_MARGIN, KEY_PART, KEY_TURN, KEY_ZOOM, NO_HIGHLIGHTS, REPLAY_DURATION, REPLAY_PAGE, REPLAY_SPEEDS, REPLAY_STEP, approach, ballView, cameraPosition, capDistance, capView, changeAfter, changeBefore, changeIndex, changeTimes, clampPlace, easeInOut, fitDistance, fitView, highlightOf, isClick, isLive, keyAction, moveAt, nearDepth, placeBetween, reachOf, replayAdvance, replayKey, replayNextSpeed, replayOf, replayPause, replayPlay, replaySeek, replaySpan, replayToggle, screenPoint, spanOfTimes, spanPart, spanTime, speedAt, stageLimits, stageSupported, surfaceOf, turnAcross, turnBetween, viewAxes, viewOf };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/support.ts"],"sourcesContent":["/**\n * This function tells if a browser can show a stage. A stage needs WebGL 2.\n *\n * A page uses it before it loads the entry `/three`. Thus a browser with no WebGL 2 shows a different picture, and it does not load `three`.\n * The function asks a canvas that is not in the page for a context, and it releases the context at once.\n * `page` is the document of the page. The default is the document of the browser. With no document, the function gives false.\n *\n * A stage can give `undefined` after this function gave true, so the page keeps its different picture ready.\n */\nexport function stageSupported(page: Document | undefined = globalThis.document): boolean {\n if (page === undefined) return false;\n try {\n const context = page.createElement(\"canvas\").getContext(\"webgl2\");\n if (context === null) return false;\n // A browser keeps only some contexts. So the function gives this one back.\n context.getExtension(\"WEBGL_lose_context\")?.loseContext();\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AASA,SAAgB,eAAe,OAA6B,WAAW,UAAmB;CACxF,IAAI,SAAS,KAAA,GAAW,OAAO;CAC/B,IAAI;EACF,MAAM,UAAU,KAAK,cAAc,QAAQ,CAAC,CAAC,WAAW,QAAQ;EAChE,IAAI,YAAY,MAAM,OAAO;EAE7B,QAAQ,aAAa,oBAAoB,CAAC,EAAE,YAAY;EACxD,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF"}
|
package/build/labels.d.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as turnAcross, m as placeBetween } from "./extent-DC0qrxC5.js";
|
|
2
2
|
// src/keys.ts
|
|
3
|
-
/** The angle of one step of an arrow key, in radians
|
|
3
|
+
/** The largest angle of one step of an arrow key, in radians. A camera far from a ball, or with no ball, turns by this angle. */
|
|
4
4
|
const KEY_TURN = Math.PI / 24;
|
|
5
|
+
/** The part of the height of the picture by which one step of an arrow key moves the surface of a ball, near the ball. */
|
|
6
|
+
const KEY_PART = .125;
|
|
5
7
|
/** The factor of the height of a camera above the surface for one step of the key `+`. */
|
|
6
8
|
const KEY_ZOOM = .85;
|
|
7
9
|
/**
|
|
8
10
|
* This function gives the action of a key on a stage, or `undefined` for a key with no action.
|
|
9
11
|
*
|
|
10
12
|
* The arrow keys turn the camera around the target. The keys `+` and `-` change the height above the surface.
|
|
11
|
-
* The keys `Home` and `0` show the home view.
|
|
13
|
+
* The keys `Home` and `0` show the home view.
|
|
14
|
+
* Near a ball, a step of an arrow key moves the surface by the part `KEY_PART` of the height of the picture.
|
|
12
15
|
* The result has no limits: the stage puts the place in its limits.
|
|
13
16
|
*/
|
|
14
17
|
function keyAction(key, now, options) {
|
|
15
18
|
const surface = options.surface ?? 0;
|
|
16
|
-
const turn = KEY_TURN *
|
|
19
|
+
const turn = Math.min(KEY_TURN, KEY_PART * turnAcross(now.distance, surface, options.fieldOfView ?? 32));
|
|
17
20
|
const zoom = (factor) => ({
|
|
18
21
|
...now,
|
|
19
22
|
distance: surface + (now.distance - surface) * factor
|
|
@@ -127,6 +130,6 @@ function approach(value, goal, seconds, time, snap = .01) {
|
|
|
127
130
|
const next = value + (goal - value) * (1 - Math.exp(0 - seconds / time));
|
|
128
131
|
return Math.abs(goal - next) < snap ? goal : next;
|
|
129
132
|
}
|
|
130
|
-
export { NO_HIGHLIGHTS as a,
|
|
133
|
+
export { NO_HIGHLIGHTS as a, KEY_PART as c, keyAction as d, CLICK_DISTANCE as i, KEY_TURN as l, easeInOut as n, highlightOf as o, moveAt as r, isClick as s, approach as t, KEY_ZOOM as u };
|
|
131
134
|
|
|
132
|
-
//# sourceMappingURL=motion-
|
|
135
|
+
//# sourceMappingURL=motion-dvvkaDwv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion-dvvkaDwv.js","names":[],"sources":["../src/keys.ts","../src/highlight.ts","../src/motion.ts"],"sourcesContent":["import { FIELD_OF_VIEW, turnAcross, type Place } from \"./view.ts\";\n\n/** The largest angle of one step of an arrow key, in radians. A camera far from a ball, or with no ball, turns by this angle. */\nexport const KEY_TURN: number = Math.PI / 24;\n\n/** The part of the height of the picture by which one step of an arrow key moves the surface of a ball, near the ball. */\nexport const KEY_PART = 0.125;\n\n/** The factor of the height of a camera above the surface for one step of the key `+`. */\nexport const KEY_ZOOM = 0.85;\n\n/** What a key does on a stage: it moves the camera to a place, or it shows a view. */\nexport type KeyAction = { readonly type: \"place\"; readonly place: Place } | { readonly type: \"view\"; readonly view: string };\n\n/** The keys of a stage. */\nexport interface KeyOptions {\n /** The name of the view of the keys `Home` and `0`. */\n readonly home: string;\n /** The name of the view of each other key, for example `{ t: \"top\" }`. A letter has no case. */\n readonly views?: Readonly<Record<string, string>> | undefined;\n /** The radius of the ball around the target that the camera stays out of, or 0 for no ball. */\n readonly surface?: number | undefined;\n /** The vertical angle of the picture, in degrees. The default is `FIELD_OF_VIEW`. */\n readonly fieldOfView?: number | undefined;\n}\n\n/**\n * This function gives the action of a key on a stage, or `undefined` for a key with no action.\n *\n * The arrow keys turn the camera around the target. The keys `+` and `-` change the height above the surface.\n * The keys `Home` and `0` show the home view.\n * Near a ball, a step of an arrow key moves the surface by the part `KEY_PART` of the height of the picture.\n * The result has no limits: the stage puts the place in its limits.\n */\nexport function keyAction(key: string, now: Place, options: KeyOptions): KeyAction | undefined {\n const surface = options.surface ?? 0;\n const turn = Math.min(KEY_TURN, KEY_PART * turnAcross(now.distance, surface, options.fieldOfView ?? FIELD_OF_VIEW));\n const zoom = (factor: number): Place => ({ ...now, distance: surface + (now.distance - surface) * factor });\n switch (key) {\n case \"ArrowLeft\":\n return { type: \"place\", place: { ...now, azimuth: now.azimuth - turn } };\n case \"ArrowRight\":\n return { type: \"place\", place: { ...now, azimuth: now.azimuth + turn } };\n case \"ArrowUp\":\n return { type: \"place\", place: { ...now, polar: now.polar - turn } };\n case \"ArrowDown\":\n return { type: \"place\", place: { ...now, polar: now.polar + turn } };\n case \"+\":\n case \"=\":\n return { type: \"place\", place: zoom(KEY_ZOOM) };\n case \"-\":\n case \"_\":\n return { type: \"place\", place: zoom(1 / KEY_ZOOM) };\n case \"Home\":\n case \"0\":\n return { type: \"view\", view: options.home };\n default: {\n const view = key.length === 1 ? options.views?.[key.toLowerCase()] : undefined;\n return view === undefined ? undefined : { type: \"view\", view };\n }\n }\n}\n","/** The highlight of a record. 0 is no highlight. 1 is a record under the pointer or in the highlighted list. 2 is the selected record. */\nexport type Highlight = 0 | 1 | 2;\n\n/** The records of a stage that have a highlight. Each record has a name. */\nexport interface Highlights {\n /** The name of the record under the pointer. */\n readonly hovered: string | undefined;\n /** The name of the selected record. */\n readonly selected: string | undefined;\n /** The names of the records that the page highlights. */\n readonly highlighted: ReadonlySet<string>;\n}\n\n/** The highlights of a stage with no pointer on it and no selected record. */\nexport const NO_HIGHLIGHTS: Highlights = { hovered: undefined, selected: undefined, highlighted: new Set() };\n\n/** This function gives the highlight of a record. The selected record has the highest highlight. */\nexport function highlightOf(highlights: Highlights, record: string): Highlight {\n if (record === highlights.selected) return 2;\n return record === highlights.hovered || highlights.highlighted.has(record) ? 1 : 0;\n}\n\n/** A pointer that moves this distance or less between down and up makes a click, in CSS pixels. */\nexport const CLICK_DISTANCE = 4;\n\n/**\n * This function tells if a pointer that went down and up made a click. A pointer that moved more than `limit` made a drag.\n * The positions and the limit are in CSS pixels.\n */\nexport function isClick(down: { readonly x: number; readonly y: number }, up: { readonly x: number; readonly y: number }, limit: number = CLICK_DISTANCE): boolean {\n return Math.hypot(up.x - down.x, up.y - down.y) <= limit;\n}\n","import { placeBetween, type Place } from \"./view.ts\";\n\n/** A move of a camera from one place to a different place. */\nexport interface Move {\n readonly from: Place;\n readonly to: Place;\n /** The time of the start of the move, in milliseconds. */\n readonly start: number;\n /** The time that the move takes, in milliseconds. */\n readonly duration: number;\n}\n\n/** The place of a camera at one time of a move. */\nexport interface MoveStep {\n readonly place: Place;\n /** This value is true at the end of the move, and after it. */\n readonly done: boolean;\n}\n\n/**\n * This function gives a part of a move with a slow start and a slow end. `part` goes from 0 to 1.\n * The result goes from 0 to 1, and it is 0.5 at the middle.\n */\nexport function easeInOut(part: number): number {\n const clamped = Math.min(Math.max(part, 0), 1);\n return clamped < 0.5 ? 4 * clamped * clamped * clamped : 1 - (-2 * clamped + 2) ** 3 / 2;\n}\n\n/**\n * This function gives the place of a camera at the time `now` of a move, in milliseconds.\n * A move with no duration is at its end immediately. `surface` is the radius of the ball around the target, or 0 for no ball.\n */\nexport function moveAt(move: Move, now: number, surface: number = 0): MoveStep {\n const part = move.duration > 0 ? Math.min(Math.max((now - move.start) / move.duration, 0), 1) : 1;\n if (part >= 1) return { place: move.to, done: true };\n return { place: placeBetween(move.from, move.to, easeInOut(part), surface), done: false };\n}\n\n/**\n * This function moves a value one step to its goal. Each step goes a constant part of the way that remains.\n *\n * `seconds` is the time of the step, and `time` is the time in which the value goes most of the way, in seconds.\n * A step with no time gives the goal. A value nearer to the goal than `snap` becomes the goal, so the steps have an end.\n */\nexport function approach(value: number, goal: number, seconds: number, time: number, snap: number = 0.01): number {\n if (!(seconds > 0) || !(time > 0)) return goal;\n const next = value + (goal - value) * (1 - Math.exp(0 - seconds / time));\n return Math.abs(goal - next) < snap ? goal : next;\n}\n"],"mappings":";;;AAGA,MAAa,WAAmB,KAAK,KAAK;;AAG1C,MAAa,WAAW;;AAGxB,MAAa,WAAW;;;;;;;;;AAyBxB,SAAgB,UAAU,KAAa,KAAY,SAA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,IAAI,IAAI;AACnF;;AAGA,MAAa,iBAAiB;;;;;AAM9B,SAAgB,QAAQ,MAAkD,IAAgD,QAAA,GAAyC;CACjK,OAAO,KAAK,MAAM,GAAG,IAAI,KAAK,GAAG,GAAG,IAAI,KAAK,CAAC,KAAK;AACrD;;;;;;ACRA,SAAgB,UAAU,MAAsB;CAC9C,MAAM,UAAU,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,GAAG,CAAC;CAC7C,OAAO,UAAU,KAAM,IAAI,UAAU,UAAU,UAAU,KAAK,KAAK,UAAU,MAAM,IAAI;AACzF;;;;;AAMA,SAAgB,OAAO,MAAY,KAAa,UAAkB,GAAa;CAC7E,MAAM,OAAO,KAAK,WAAW,IAAI,KAAK,IAAI,KAAK,KAAK,MAAM,KAAK,SAAS,KAAK,UAAU,CAAC,GAAG,CAAC,IAAI;CAChG,IAAI,QAAQ,GAAG,OAAO;EAAE,OAAO,KAAK;EAAI,MAAM;CAAK;CACnD,OAAO;EAAE,OAAO,aAAa,KAAK,MAAM,KAAK,IAAI,UAAU,IAAI,GAAG,OAAO;EAAG,MAAM;CAAM;AAC1F;;;;;;;AAQA,SAAgB,SAAS,OAAe,MAAc,SAAiB,MAAc,OAAe,KAAc;CAChH,IAAI,EAAE,UAAU,MAAM,EAAE,OAAO,IAAI,OAAO;CAC1C,MAAM,OAAO,SAAS,OAAO,UAAU,IAAI,KAAK,IAAI,IAAI,UAAU,IAAI;CACtE,OAAO,KAAK,IAAI,OAAO,IAAI,IAAI,OAAO,OAAO;AAC/C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as StageView, l as StageExtent, r as Highlight, t as StageTheme, x as Place } from "./theme-3EGbXXoP.js";
|
|
2
2
|
import { Object3D, PerspectiveCamera, Raycaster } from "three";
|
|
3
3
|
/** The record under the pointer: its name, and the value that the content gives for it. */
|
|
4
4
|
interface StagePick<P> {
|
|
@@ -107,8 +107,6 @@ interface Stage<P, T extends StageTheme = StageTheme> {
|
|
|
107
107
|
/** This function removes the canvas and releases the memory of the graphics card. It disposes the content. */
|
|
108
108
|
dispose(): void;
|
|
109
109
|
}
|
|
110
|
-
/** The default vertical angle of the picture, in degrees. */
|
|
111
|
-
declare const FIELD_OF_VIEW = 32;
|
|
112
110
|
/** The default lights: a strong light from above and below, and a light from the front left. */
|
|
113
111
|
declare const STAGE_LIGHTS: StageLights;
|
|
114
112
|
/**
|
|
@@ -122,5 +120,5 @@ declare const STAGE_LIGHTS: StageLights;
|
|
|
122
120
|
* The page then shows a different picture of the same data.
|
|
123
121
|
*/
|
|
124
122
|
declare function createStage<P, T extends StageTheme = StageTheme>(container: HTMLElement, options: StageOptions<P, T>): Stage<P, T> | undefined;
|
|
125
|
-
export {
|
|
126
|
-
//# sourceMappingURL=stage-
|
|
123
|
+
export { StageLights as a, createStage as c, StageFrame as i, Stage as n, StageOptions as o, StageContent as r, StagePick as s, STAGE_LIGHTS as t };
|
|
124
|
+
//# sourceMappingURL=stage-Bhu1f7Dw.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage-
|
|
1
|
+
{"version":3,"file":"stage-Bhu1f7Dw.d.ts","names":[],"sources":["../src/stage/stage.ts"],"mappings":";;;UAYiB,UAAU;;WAEhB;;WAEA,OAAO;;;UAID;WACN,QAAQ;;WAER;;;;;WAKA;;WAEA;;WAEA;;;;;;UAOM,aAAa,GAAG,UAAU,aAAa;;WAE7C,kBAAkB;;WAElB,QAAQ;;EAEjB,IAAI;;EAEJ,KAAK,KAAK,YAAY,UAAU;;EAEhC,MAAM,OAAO,GAAG,YAAY,mBAAmB;;;;;EAK/C,MAAM,OAAO;;EAEb;;;UAIe;;WAEN;;WAEA;;WAEA;aAAiB;aAAoB;aAAoB;;;;UAInD,aAAa,GAAG,UAAU,aAAa;;WAE7C,SAAS,aAAa,GAAG;WACzB,OAAO;;WAEP;;WAEA,OAAO,SAAS,eAAe;;WAE/B;;WAEA,OAAO,SAAS;;WAEhB;;WAEA;aAAmB;aAAmC;;;WAEtD;WACA,SAAS;;WAET,YAAY,MAAM;;WAElB,aAAa,MAAM;;;UAIb,MAAM,GAAG,UAAU,aAAa;;WAEtC,QAAQ;;EAEjB,WAAW,SAAS,aAAa,GAAG;;EAEpC,SAAS,OAAO;;EAEhB,QAAQ,eAAe,WAAW;;EAElC,SAAS;;EAET,UAAU;;EAEV,OAAO;;EAEP;;EAEA;;;cAIW,cAAc;;;;;;;;;;;iBAgCX,YAAY,GAAG,UAAU,aAAa,YAAY,WAAW,aAAa,SAAS,aAAa,GAAG,KAAK,MAAM,GAAG"}
|