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 · Markers on the globe

projectAllfunction

Project many points into flat arrays (reused between calls); z is the cosine used for a point's facing test.

Import it

import { projectAll } from "@johnmorrisdotca/chikyu-earth/markers";

Definition

function projectAll(lons: ArrayLike<number>, lats: ArrayLike<number>, count: number, pose: Pose, xs: Float32Array, ys: Float32Array, zs: Float32Array): void

Parameters

NameTypeDescription
lonsArrayLike<number>

Longitudes in degrees.

latsArrayLike<number>

Latitudes in degrees.

countnumber

How many points to project.

posePose

The view.

xsFloat32Array<ArrayBufferLike>

Filled with each point's x in pixels.

ysFloat32Array<ArrayBufferLike>

Filled with each point's y in pixels.

zsFloat32Array<ArrayBufferLike>

Filled with each point's z: above 0 it faces the viewer.

Examples

import { projectAll } from "@johnmorrisdotca/chikyu-earth/markers";

const xs = new Float32Array(2);
const ys = new Float32Array(2);
const zs = new Float32Array(2);
projectAll([0, 180], [0, 0], 2, { lon: 0, lat: 0, radius: 100, cx: 100, cy: 100 }, xs, ys, zs);
console.log(zs[0], zs[1]);
1 -1

What it prints (run when this page was built)

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