Video Thumbnail

Sign up for a plan to instantly unlock all premium lessons.

Premium Features

Download Video

2. Placing Points with Latitude and Longitude

Published 9 days ago

Say you want to display a few key locations on your globe—points you can interact with to display some sort of extra data such as population. Getting those points onto your sphere in the correct spots requires a bit of geometry and trigonometry magic.

In this tutorial, I'll show you how to perfectly place Three.js spheres on your globe using the world's accepted latitude and longitudinal coordinate system.

Equations for converting lat and lng to 3D coordinates:

const x = radius * Math.cos(latitude) * Math.sin(longitude)
const y = radius * Math.sin(latitude)
const z = radius * Math.cos(latitude) * Math.cos(longitude)

Comments

Want to participate?

Create a free Chris Courses account to begin

or
Sign In

No comments yet, be the first to add one

Cheat Sheet Preview

Download The Official Chris Courses HTML5 Canvas Cheat Sheet

Essential canvas syntax at your fingertips.

Download Now

Providing the lift to launch your development career

© 2021 Chris Courses. All rights reserved.