sharedEdges関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { sharedEdges } from "@johnmorrisdotca/chikyu-earth/realistic";
定義
function sharedEdges(shapes: BorderShapes, maxStep?: number): Float32Array
引数
| 名前 | 型 | 説明 |
|---|---|---|
shapes | BorderShapes | The shapes, in longitude and latitude. |
maxStep (省略可) | number | The longest piece in degrees (1 when left out). |
戻り値
Float32Array<ArrayBufferLike>
The segments' ends, x, y, z for each, two points to a segment: ready for a LineSegments geometry.
例
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出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。