Skip to the content

Chikyu Earth地球

A line-drawn globe of the world's countries that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place.

Chikyu is the Japanese word 地球 for the Earth. About the name

Contents

Reference · The realistic Earth's pure parts

sharedEdgesfunction

The borders of a set of shapes as line segments on the unit sphere: each edge that two different shapes share, drawn once; an edge only one shape has (a coast) is left out. An edge longer than maxStep degrees is cut into pieces along the great circle, so the line keeps to the ground.

Import it

import { sharedEdges } from "@johnmorrisdotca/chikyu-earth/realistic";

Definition

function sharedEdges(shapes: BorderShapes, maxStep?: number): Float32Array

Parameters

NameTypeDescription
shapesBorderShapes

The shapes, in longitude and latitude.

maxStep (optional)number

The longest piece in degrees (1 when left out).

Returns

Float32Array<ArrayBufferLike>

The segments' ends, x, y, z for each, two points to a segment: ready for a LineSegments geometry.

Examples

import { sharedEdges } from "@johnmorrisdotca/chikyu-earth/realistic";

const west = { geometry: { type: "Polygon", coordinates: [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]] } };
const east = { geometry: { type: "Polygon", coordinates: [[[1, 0], [2, 0], [2, 1], [1, 1], [1, 0]]] } };
console.log(sharedEdges({ features: [west, east] }).length / 6);
1

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chikyu-earth 0.51.1.