Skip to content

snorrwe/orbit-upvector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Given the position of an orbital camera in polar coordinates: $(\theta \phi r)$

We want to compute the position and the up-vector in cartesian coordiantes:

${position}=\left[\begin{matrix}r \sin{\left(\theta \right)} \cos{\left(\phi \right)}\\r \sin{\left(\phi \right)} \sin{\left(\theta \right)}\\r \cos{\left(\theta \right)}\end{matrix}\right]$

The up vector always points towards the north pole of the sphere the camera is orbiting. In a Y-up coordinate system this means towards ${Y}=\left[\begin{matrix}0 & 1 & 0\end{matrix}\right]$.

${up}=\left[\begin{matrix}- \sin{\left(\phi \right)} \sin^{2}{\left(\theta \right)} \cos{\left(\phi \right)}\\\sin^{2}{\left(\theta \right)} \cos^{2}{\left(\phi \right)} + \cos^{2}{\left(\theta \right)}\\- \sin{\left(\phi \right)} \sin{\left(\theta \right)} \cos{\left(\theta \right)}\end{matrix}\right]$

Do note that the up vector is not normalized!

Demo showing position and up vector

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors