Skip to content

ofmooseandmen/twinf

Repository files navigation

The World Is Not Flat

NPM package license

Rendering shapes defined by latitude and longitude with WebGL2.

Only tested on Chrome so far.

Build

npm run test

Demo

click me!

Allow some time for the coastline and tracks to be fetched, then use arrow keys to pan and +/- to zoom in/out. Tracks are fetched every 10 seconds from opensky.

Concepts

TWINF allows to draw shapes defined by latitude and longitude on a canvas using the WebGL2 context.

The following transformations are applied to shapes:

  • In the CPU: conversion from latitude/longitude coordinate system to geocentric coordinate system assuming a spherical earth model
  • In the CPU: triangulation of spherical and planar polygons
  • In the GPU: conversion from geocentric coordinate system to stereographic coordinate system
  • In the GPU: conversion from stereographic coordinate system to canvas coordinate system
  • In the GPU: conversion from canvas to WebGL clipspace