@mark1russell7/visuals 0.3.0 → 0.3.1

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 CHANGED
@@ -185,6 +185,7 @@ const stage = createStage(document.body, {
185
185
  - An area is a region of `@mark1russell7/geo`: a `Polygon` or a `MultiPolygon` of GeoJSON. A point is a place with a latitude and a longitude.
186
186
  - The surface of an area follows the curve of the Earth. The option `step` sets the largest step of an edge, in degrees.
187
187
  - A kind names the style of an area or a point in the theme. A new theme changes each color, and the geometry stays.
188
+ - A style with `dash` draws the edge of its areas as a dashed line. `dash` has the length of a dash and of a gap, in CSS pixels. The edge of a highlight keeps the dash.
188
189
  - The pointer finds a point first, then the last area of the list. The pointer ignores a part with `pick: false`.
189
190
  - `show` hides each part that a test refuses, for example the records that are not active at a time.
190
191
  - `placeAt` gives the place on the Earth under the pointer.
package/build/globe.d.ts CHANGED
@@ -11,6 +11,13 @@ interface GlobeStyle {
11
11
  readonly opacity?: number | undefined;
12
12
  /** The color of the edge of an area, or of the ring around a point. An area with no color has no edge. */
13
13
  readonly line?: string | undefined;
14
+ /**
15
+ * The lengths of a dash and of a gap of the edge of an area, in CSS pixels. An edge with no `dash` is a solid line.
16
+ * The lengths are correct on the surface below the camera, at each distance of the camera. Near the rim of the Earth, a dash is shorter in the picture.
17
+ * A length that is not more than 0 gives a solid line.
18
+ * The edge of a record with a highlight keeps the dash, and the ring of a point has no dash.
19
+ */
20
+ readonly dash?: readonly [dash: number, gap: number] | undefined;
14
21
  }
15
22
  /** The colors of a globe. Each color is a CSS hex color. */
16
23
  interface GlobeTheme extends StageTheme {
@@ -1 +1 @@
1
- {"version":3,"file":"globe.d.ts","names":[],"sources":["../src/globe/content.ts","../src/globe/mesh.ts","../src/globe/space.ts"],"mappings":";;;;;;UA6BiB;;WAEN;;WAEA;;WAEA;;;UAIM,mBAAmB;;WAEzB;;WAEA;;WAEA;;WAEA,QAAQ,SAAS,eAAe;;WAEhC,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O;;WAEP;;WAEA;;;UAIM,UAAU;;WAEhB;;WAEA,QAAQ;;WAER;;WAEA,OAAO;;WAEP;;;UAIM,WAAW;;WAEjB;WACA,OAAO;;WAEP;;WAEA,OAAO;;WAEP;;WAEA;;;UAIM,aAAa;;WAEnB,iBAAiB,UAAU;;WAE3B,kBAAkB,WAAW;;WAE7B;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;UAIM,aAAa,WAAW,aAAa,GAAG;;;;;EAKvD,KAAK,OAAO,MAAM,UAAU,KAAK,WAAW;;EAE5C,QAAQ,KAAK,YAAY;;;;;;wBAmBX,YAAY;;;;;;;wBAyKZ,YAAY,GAAG,UAAS,aAAa,KAAU,aAAa;;;;;UCpT3D;;WAEN,SAAS;;WAET,WAAW;;;qBAIT;;;;;wBA0CG,WAAW;;;;;;;;;;;;;wBAyOX,cAAc,QAAQ,QAAQ,cAAc,sBAA2C;;;;;;;;wBA6GvF,YAAY,QAAQ,QAAQ,eAAe;;;;;;;wBA4E3C,UAAU,iBAAiB,eAAe;;;;;qBCld7C;WAAwB;WAAsB;;;;;;;;wBAU3C,WAAW,OAAO,QAAQ,kBAAqB;;;;;wBAS/C,WAAW,OAAO,SAAS;;wBAO3B,YAAY,OAAO,SAAS;;;;;;;wBAU5B,UAAU,OAAO,QAAQ,kBAAsB,kBAA8B;;;;;;wBAS7E,WAAW,kBAAkB,UAAU,kBAA8B;;;;;;wBAiBrE,QAAQ,QAAQ,QAAQ,WAAW,QAAQ,iBAAiB;;;;;wBAe5D,QAAQ,OAAO,QAAQ,KAAK,QAAQ"}
package/build/globe.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as ballView, r as capView, t as FIT_MARGIN } from "./extent-DC0qrxC5.js";
2
- import { BufferAttribute, BufferGeometry, Color, FrontSide, InstancedInterleavedBuffer, InterleavedBufferAttribute, Mesh, MeshBasicMaterial, Points, ShaderMaterial, ShapeUtils, Sphere, SphereGeometry, Vector2, Vector3 } from "three";
2
+ import { BufferAttribute, BufferGeometry, Color, FrontSide, Group, InstancedInterleavedBuffer, InterleavedBufferAttribute, Mesh, MeshBasicMaterial, Points, ShaderMaterial, ShapeUtils, Sphere, SphereGeometry, Vector2, Vector3 } from "three";
3
3
  import { densify, fromUnitVector, pointLocator, toUnitVector } from "@mark1russell7/geo";
4
4
  import { LineMaterial } from "three/addons/lines/LineMaterial.js";
5
5
  import { LineSegments2 } from "three/addons/lines/LineSegments2.js";
@@ -633,15 +633,31 @@ void main() {
633
633
  if (gl_FragColor.a <= 0.0) discard;
634
634
  #include <colorspace_fragment>
635
635
  }`;
636
+ /** This function gives the dash of a style. A style with no dash gives `undefined`, and so does a length that is not more than 0. */
637
+ function dashOf(style) {
638
+ const [dash, gap] = style.dash ?? [0, 0];
639
+ return Number.isFinite(dash) && Number.isFinite(gap) && dash > 0 && gap > 0 ? [dash, gap] : void 0;
640
+ }
641
+ /** This function adds an area to the areas with the same pattern of a dash. */
642
+ function addPattern(patterns, dash, part) {
643
+ const pattern = dash.join(" ");
644
+ const same = patterns.get(pattern);
645
+ if (same === void 0) patterns.set(pattern, [part]);
646
+ else same.push(part);
647
+ }
636
648
  /** This function gives the text of a thrown value. */
637
649
  function messageOf(error) {
638
650
  return error instanceof Error ? error.message : String(error);
639
651
  }
640
- /** 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. */
641
- function addSegments(lines, radius, to) {
652
+ /**
653
+ * 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.
654
+ * With `lengths`, it also writes two numbers for each segment: the length of the line to the start of the segment, and to its end.
655
+ */
656
+ function addSegments(lines, radius, to, lengths) {
642
657
  let count = 0;
643
658
  for (const line of lines) {
644
659
  let from;
660
+ let length = 0;
645
661
  for (let index = 0; index + 1 < line.length; index += 2) {
646
662
  const next = globePoint({
647
663
  lat: line[index + 1] ?? 0,
@@ -649,6 +665,11 @@ function addSegments(lines, radius, to) {
649
665
  }, radius);
650
666
  if (from !== void 0) {
651
667
  to.push(from.x, from.y, from.z, next.x, next.y, next.z);
668
+ if (lengths !== void 0) {
669
+ const end = length + Math.hypot(next.x - from.x, next.y - from.y, next.z - from.z);
670
+ lengths.push(length, end);
671
+ length = end;
672
+ }
652
673
  count += 1;
653
674
  }
654
675
  from = next;
@@ -713,13 +734,14 @@ function createGlobe(options = {}) {
713
734
  grid.frustumCulled = false;
714
735
  const surfaces = [];
715
736
  const segmentList = [];
737
+ const lengthList = [];
716
738
  const areaParts = [];
717
739
  let cornerTotal = 0;
718
740
  let indexTotal = 0;
719
741
  let segmentTotal = 0;
720
742
  for (const area of options.areas ?? []) try {
721
743
  const surface = regionSurface(area.region, step);
722
- const segmentCount = addSegments(regionEdges(area.region, step), layer, segmentList);
744
+ const segmentCount = addSegments(regionEdges(area.region, step), layer, segmentList, lengthList);
723
745
  areaParts.push({
724
746
  area,
725
747
  locate: area.pick === false ? void 0 : pointLocator(area.region),
@@ -732,6 +754,7 @@ function createGlobe(options = {}) {
732
754
  shown: true,
733
755
  filled: false,
734
756
  lined: false,
757
+ dash: void 0,
735
758
  highlight: 0
736
759
  });
737
760
  surfaces.push(surface);
@@ -789,6 +812,14 @@ function createGlobe(options = {}) {
789
812
  const edges = new LineSegments2(edgeGeometry, edgeMaterial);
790
813
  edges.renderOrder = 3;
791
814
  edges.frustumCulled = false;
815
+ const allLengths = Float32Array.from(lengthList);
816
+ const dashed = new Group();
817
+ let dashedLines = [];
818
+ let litLines = [];
819
+ /** The text of the dashed edges of the last picture. The globe makes the objects again only for a different text. */
820
+ let dashedText = "[]";
821
+ /** The count of CSS pixels of one unit of the stage, on the surface below the camera. */
822
+ let dashScale = 1;
792
823
  const highlightMaterial = new LineMaterial({
793
824
  linewidth: options.highlightWidth ?? 2.5,
794
825
  vertexColors: true,
@@ -853,6 +884,7 @@ function createGlobe(options = {}) {
853
884
  const style = styleOf(theme, part.area.kind);
854
885
  part.filled = style.fill !== void 0;
855
886
  part.lined = style.line !== void 0;
887
+ part.dash = dashOf(style);
856
888
  if (style.fill !== void 0) {
857
889
  color.set(style.fill);
858
890
  const opacity = Math.min(Math.max(style.opacity ?? 1, 0), 1);
@@ -879,25 +911,109 @@ function createGlobe(options = {}) {
879
911
  for (let segment = 0; segment < part.segmentCount; segment++) allSegmentColors.set(values, (part.firstSegment + segment) * 6);
880
912
  }
881
913
  };
914
+ /** This function releases objects of the edges with dashes, and removes them from the picture. */
915
+ const release = (lines) => {
916
+ for (const line of lines) {
917
+ line.geometry.dispose();
918
+ line.material.dispose();
919
+ dashed.remove(line);
920
+ }
921
+ };
922
+ /**
923
+ * This function makes one object of edges with dashes for each pattern, from the segments of the areas of the pattern.
924
+ * `paint` writes the colors of the segments of an area into a list, from a position of the list.
925
+ */
926
+ const dashedObjects = (patterns, width, order, paint) => {
927
+ const lines = [];
928
+ for (const parts of patterns.values()) {
929
+ const dash = parts[0]?.dash;
930
+ if (dash === void 0) continue;
931
+ const count = parts.reduce((sum, part) => sum + part.segmentCount, 0);
932
+ const positions = new Float32Array(count * 6);
933
+ const colors = new Float32Array(count * 6);
934
+ const lengths = new Float32Array(count * 2);
935
+ let at = 0;
936
+ for (const part of parts) {
937
+ const to = part.firstSegment + part.segmentCount;
938
+ positions.set(allSegments.subarray(part.firstSegment * 6, to * 6), at * 6);
939
+ paint(part, colors, at * 6);
940
+ lengths.set(allLengths.subarray(part.firstSegment * 2, to * 2), at * 2);
941
+ at += part.segmentCount;
942
+ }
943
+ const geometry = segmentGeometry(new InstancedInterleavedBuffer(positions, 6, 1), new InstancedInterleavedBuffer(colors, 6, 1), count, bounds);
944
+ const distances = new InstancedInterleavedBuffer(lengths, 2, 1);
945
+ geometry.setAttribute("instanceDistanceStart", new InterleavedBufferAttribute(distances, 1, 0));
946
+ geometry.setAttribute("instanceDistanceEnd", new InterleavedBufferAttribute(distances, 1, 1));
947
+ const material = new LineMaterial({
948
+ linewidth: width,
949
+ vertexColors: true,
950
+ transparent: true,
951
+ depthWrite: false,
952
+ dashed: true,
953
+ dashSize: dash[0],
954
+ gapSize: dash[1],
955
+ dashScale
956
+ });
957
+ const line = new LineSegments2(geometry, material);
958
+ line.renderOrder = order;
959
+ line.frustumCulled = false;
960
+ dashed.add(line);
961
+ lines.push(line);
962
+ }
963
+ return lines;
964
+ };
965
+ /** This function makes the objects of the edges with dashes: one object for each pattern, with the segments of its areas. */
966
+ const syncDashed = (patterns, theme) => {
967
+ const text = JSON.stringify([...patterns].map(([pattern, parts]) => [pattern, parts.map((part) => [part.firstSegment, styleOf(theme, part.area.kind).line])]));
968
+ if (text === dashedText) return;
969
+ dashedText = text;
970
+ release(dashedLines);
971
+ dashedLines = dashedObjects(patterns, options.lineWidth ?? 1.25, 3, (part, colors, at) => {
972
+ colors.set(allSegmentColors.subarray(part.firstSegment * 6, (part.firstSegment + part.segmentCount) * 6), at);
973
+ });
974
+ };
975
+ /**
976
+ * This function makes the dashed edges of the records with a highlight: one object for each pattern, above the other edges.
977
+ * They are few, and a record changes its highlight only on an act of a person. So the globe makes them again at each change.
978
+ */
979
+ const syncLit = (patterns, theme) => {
980
+ release(litLines);
981
+ litLines = dashedObjects(patterns, options.highlightWidth ?? 2.5, 5, (part, colors, at) => {
982
+ color.set(highlightColor(theme, part.highlight));
983
+ const values = [
984
+ color.r,
985
+ color.g,
986
+ color.b,
987
+ color.r,
988
+ color.g,
989
+ color.b
990
+ ];
991
+ for (let segment = 0; segment < part.segmentCount; segment++) colors.set(values, at + segment * 6);
992
+ });
993
+ };
882
994
  /** This function puts the data of the shown parts at the start of the buffers that the picture draws. */
883
995
  const sync = (theme) => {
884
996
  let indexCount = 0;
885
997
  let segmentCount = 0;
886
998
  let highlightCount = 0;
999
+ const patterns = /* @__PURE__ */ new Map();
1000
+ const lit = /* @__PURE__ */ new Map();
887
1001
  for (const part of areaParts) {
888
1002
  if (!part.shown) continue;
889
1003
  if (part.filled) {
890
1004
  fillIndices.array.set(allIndices.subarray(part.firstIndex, part.firstIndex + part.indexCount), indexCount);
891
1005
  indexCount += part.indexCount;
892
1006
  }
893
- if (part.lined) {
1007
+ if (part.lined && part.dash !== void 0) addPattern(patterns, part.dash, part);
1008
+ else if (part.lined) {
894
1009
  const from = part.firstSegment * 6;
895
1010
  const to = from + part.segmentCount * 6;
896
1011
  edgePositions.array.set(allSegments.subarray(from, to), segmentCount * 6);
897
1012
  edgeColors.array.set(allSegmentColors.subarray(from, to), segmentCount * 6);
898
1013
  segmentCount += part.segmentCount;
899
1014
  }
900
- if (part.highlight !== 0) highlightCount += part.segmentCount;
1015
+ if (part.highlight !== 0 && part.dash !== void 0) addPattern(lit, part.dash, part);
1016
+ else if (part.highlight !== 0) highlightCount += part.segmentCount;
901
1017
  }
902
1018
  fillIndices.needsUpdate = true;
903
1019
  fillGeometry.setDrawRange(0, indexCount);
@@ -906,11 +1022,13 @@ function createGlobe(options = {}) {
906
1022
  edgeColors.needsUpdate = true;
907
1023
  edgeGeometry.instanceCount = segmentCount;
908
1024
  edges.visible = segmentCount > 0;
1025
+ syncDashed(patterns, theme);
1026
+ syncLit(lit, theme);
909
1027
  const highlightPositions = new Float32Array(highlightCount * 6);
910
1028
  const highlightColors = new Float32Array(highlightCount * 6);
911
1029
  let at = 0;
912
1030
  for (const part of areaParts) {
913
- if (!part.shown || part.highlight === 0) continue;
1031
+ if (!part.shown || part.highlight === 0 || part.dash !== void 0) continue;
914
1032
  color.set(highlightColor(theme, part.highlight));
915
1033
  const values = [
916
1034
  color.r,
@@ -956,6 +1074,7 @@ function createGlobe(options = {}) {
956
1074
  grid,
957
1075
  fills,
958
1076
  edges,
1077
+ dashed,
959
1078
  shade,
960
1079
  highlighted,
961
1080
  dots
@@ -1021,6 +1140,10 @@ function createGlobe(options = {}) {
1021
1140
  },
1022
1141
  step(frame) {
1023
1142
  pixelAngle = 2 * Math.tan(frame.fieldOfView * Math.PI / 360) / Math.max(frame.height, 1);
1143
+ const height = Math.max(frame.camera.position.length() - radius, radius * 1e-6);
1144
+ dashScale = 1 / (pixelAngle * height);
1145
+ for (const line of dashedLines) line.material.dashScale = dashScale;
1146
+ for (const line of litLines) line.material.dashScale = dashScale;
1024
1147
  return false;
1025
1148
  },
1026
1149
  show(test) {
@@ -1042,6 +1165,10 @@ function createGlobe(options = {}) {
1042
1165
  fillMaterial.dispose();
1043
1166
  edgeGeometry.dispose();
1044
1167
  edgeMaterial.dispose();
1168
+ release(dashedLines);
1169
+ release(litLines);
1170
+ dashedLines = [];
1171
+ litLines = [];
1045
1172
  highlighted.geometry.dispose();
1046
1173
  highlightMaterial.dispose();
1047
1174
  pointGeometry.dispose();
@@ -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 * 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();\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,SAAS,KAAA,KAAa,KAAK,MAAM,SAAS,MAAM,KAAK,MAAM,SAAS,IAAI,OAAO,KAAK,IAAI,QAAQ,SAAS,IAAI,SAAS,EAAE,CAAC;CAC/H;CACA,MAAM,QAAQ,OAAO;CACrB,OAAO,OAAO,SAAS,KAAK,UAAU,KAAA,KAAa,OAAO,OAAO,SAAS,EAAE,EAAE,OAAO,KAAK,MAAM,MAAM,OAAO,IAAI;CACjH,OAAO;AACT;;;;;AAMA,SAAS,SAAS,KAAwB,KAAwB,GAAW,GAAmB;CAC9F,MAAM,OAAO,GAAG,KAAK,CAAC;CACtB,MAAM,OAAO,GAAG,KAAK,CAAC;CACtB,MAAM,OAAO,KAAK,IAAI,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,IAAI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K;GAClC;GACA,KAAK,MAAM,QAAQ,WAAW;IAC5B,MAAM,OAAO,UAAU,KAAK,KAAK,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"}
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 Group,\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 * The lengths of a dash and of a gap of the edge of an area, in CSS pixels. An edge with no `dash` is a solid line.\n * The lengths are correct on the surface below the camera, at each distance of the camera. Near the rim of the Earth, a dash is shorter in the picture.\n * A length that is not more than 0 gives a solid line.\n * The edge of a record with a highlight keeps the dash, and the ring of a point has no dash.\n */\n readonly dash?: readonly [dash: number, gap: number] | 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/** The lengths of a dash and of a gap of a line, in CSS pixels. */\ntype Dash = readonly [dash: number, gap: number];\n\n/** This function gives the dash of a style. A style with no dash gives `undefined`, and so does a length that is not more than 0. */\nfunction dashOf(style: GlobeStyle): Dash | undefined {\n const [dash, gap] = style.dash ?? [0, 0];\n return Number.isFinite(dash) && Number.isFinite(gap) && dash > 0 && gap > 0 ? [dash, gap] : undefined;\n}\n\n/** This function adds an area to the areas with the same pattern of a dash. */\nfunction addPattern<T>(patterns: Map<string, T[]>, dash: Dash, part: T): void {\n const pattern = dash.join(\" \");\n const same = patterns.get(pattern);\n if (same === undefined) patterns.set(pattern, [part]);\n else same.push(part);\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 /** The dash of the edge, or `undefined` for a solid line. */\n dash: Dash | undefined;\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/**\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.\n * With `lengths`, it also writes two numbers for each segment: the length of the line to the start of the segment, and to its end.\n */\nfunction addSegments(lines: readonly Float64Array[], radius: number, to: number[], lengths?: number[]): number {\n let count = 0;\n for (const line of lines) {\n let from: Point3 | undefined;\n let length = 0;\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 if (lengths !== undefined) {\n const end = length + Math.hypot(next.x - from.x, next.y - from.y, next.z - from.z);\n lengths.push(length, end);\n length = end;\n }\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 lengthList: 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, lengthList);\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 dash: undefined,\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 with dashes. A line material has one pattern, so each pattern of the theme gets an object of its own in this group.\n // The group keeps the order 0. Thus three.js sorts its objects with the other objects of the globe, by their own order.\n // The areas with a dash and a highlight get one more object for each pattern, with the order and the width of the highlight.\n const allLengths = Float32Array.from(lengthList);\n const dashed = new Group();\n let dashedLines: LineSegments2[] = [];\n let litLines: LineSegments2[] = [];\n /** The text of the dashed edges of the last picture. The globe makes the objects again only for a different text. */\n let dashedText = \"[]\";\n /** The count of CSS pixels of one unit of the stage, on the surface below the camera. */\n let dashScale = 1;\n\n // The solid 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 part.dash = dashOf(style);\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 releases objects of the edges with dashes, and removes them from the picture. */\n const release = (lines: readonly LineSegments2[]): void => {\n for (const line of lines) {\n line.geometry.dispose();\n line.material.dispose();\n dashed.remove(line);\n }\n };\n\n /**\n * This function makes one object of edges with dashes for each pattern, from the segments of the areas of the pattern.\n * `paint` writes the colors of the segments of an area into a list, from a position of the list.\n */\n const dashedObjects = (\n patterns: ReadonlyMap<string, readonly AreaPart<P>[]>,\n width: number,\n order: number,\n paint: (part: AreaPart<P>, colors: Float32Array, at: number) => void,\n ): LineSegments2[] => {\n const lines: LineSegments2[] = [];\n for (const parts of patterns.values()) {\n const dash = parts[0]?.dash;\n if (dash === undefined) continue;\n const count = parts.reduce((sum, part) => sum + part.segmentCount, 0);\n const positions = new Float32Array(count * 6);\n const colors = new Float32Array(count * 6);\n const lengths = new Float32Array(count * 2);\n let at = 0;\n for (const part of parts) {\n const to = part.firstSegment + part.segmentCount;\n positions.set(allSegments.subarray(part.firstSegment * 6, to * 6), at * 6);\n paint(part, colors, at * 6);\n lengths.set(allLengths.subarray(part.firstSegment * 2, to * 2), at * 2);\n at += part.segmentCount;\n }\n const geometry = segmentGeometry(new InstancedInterleavedBuffer(positions, 6, 1), new InstancedInterleavedBuffer(colors, 6, 1), count, bounds);\n const distances = new InstancedInterleavedBuffer(lengths, 2, 1);\n geometry.setAttribute(\"instanceDistanceStart\", new InterleavedBufferAttribute(distances, 1, 0));\n geometry.setAttribute(\"instanceDistanceEnd\", new InterleavedBufferAttribute(distances, 1, 1));\n const material = new LineMaterial({ linewidth: width, vertexColors: true, transparent: true, depthWrite: false, dashed: true, dashSize: dash[0], gapSize: dash[1], dashScale });\n const line = new LineSegments2(geometry, material);\n line.renderOrder = order;\n line.frustumCulled = false;\n dashed.add(line);\n lines.push(line);\n }\n return lines;\n };\n\n /** This function makes the objects of the edges with dashes: one object for each pattern, with the segments of its areas. */\n const syncDashed = (patterns: ReadonlyMap<string, readonly AreaPart<P>[]>, theme: GlobeTheme): void => {\n const text = JSON.stringify([...patterns].map(([pattern, parts]) => [pattern, parts.map((part) => [part.firstSegment, styleOf(theme, part.area.kind).line])]));\n if (text === dashedText) return;\n dashedText = text;\n release(dashedLines);\n dashedLines = dashedObjects(patterns, options.lineWidth ?? 1.25, 3, (part, colors, at) => {\n colors.set(allSegmentColors.subarray(part.firstSegment * 6, (part.firstSegment + part.segmentCount) * 6), at);\n });\n };\n\n /**\n * This function makes the dashed edges of the records with a highlight: one object for each pattern, above the other edges.\n * They are few, and a record changes its highlight only on an act of a person. So the globe makes them again at each change.\n */\n const syncLit = (patterns: ReadonlyMap<string, readonly AreaPart<P>[]>, theme: GlobeTheme): void => {\n release(litLines);\n litLines = dashedObjects(patterns, options.highlightWidth ?? 2.5, 5, (part, colors, at) => {\n color.set(highlightColor(theme, part.highlight));\n const values = [color.r, color.g, color.b, color.r, color.g, color.b];\n for (let segment = 0; segment < part.segmentCount; segment++) colors.set(values, at + 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 const patterns = new Map<string, AreaPart<P>[]>();\n const lit = new Map<string, AreaPart<P>[]>();\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 && part.dash !== undefined) {\n addPattern(patterns, part.dash, part);\n } else 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 // The edge of a highlight keeps the dash of its area.\n if (part.highlight !== 0 && part.dash !== undefined) addPattern(lit, part.dash, part);\n else 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 syncDashed(patterns, theme);\n syncLit(lit, theme);\n\n // The solid 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 || part.dash !== undefined) 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, dashed, 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 // A dash has a constant length in the picture. So its scale follows the height of the camera above the surface.\n const height = Math.max(frame.camera.position.length() - radius, radius * 1e-6);\n dashScale = 1 / (pixelAngle * height);\n for (const line of dashedLines) line.material.dashScale = dashScale;\n for (const line of litLines) line.material.dashScale = dashScale;\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 release(dashedLines);\n release(litLines);\n dashedLines = [];\n litLines = [];\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,SAAS,KAAA,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;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,QAAQ,WAAW;GACnB,QAAQ,QAAQ;GAChB,cAAc,CAAC;GACf,WAAW,CAAC;GACZ,YAAY,SAAS,QAAQ;GAC7B,kBAAkB,QAAQ;GAC1B,cAAc,QAAQ;GACtB,cAAc,QAAQ;EACxB;CACF;AACF"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/visuals",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "description": "3D stages for data on three.js: a camera that a person moves, views by name, picking, highlights and themes, a globe of the Earth, and the shared marks of the viewers as data.",
6
6
  "license": "MIT",
7
7
  "repository": {