Ellipsoid.find_limbs¶
giant.ray_tracer.shapes.ellipsoid
:
- Ellipsoid.find_limbs(self, scan_center_dir, scan_dirs, observer_position=None)¶
The method determines the limb points (visible edge of the ellipsoid) that would be an observed for an observer located at
observer_position
looking towardscan_center_dir
along the directions given byscan_dirs
.Typically it is assumed that the location of the observer is at the origin of the current frame and therefore
observer_position
can be left asNone
.The limb for the ellipsoid is found by first solving for the particular solution to the underdetermined system of equations
\[\begin{split}\left[\begin{array}{c} \mathbf{s}_c^T\mathbf{A}_C \\ \left(\mathbf{s}_c\times\mathbf{s}_d\right)^T\end{array}\right]\mathbf{p}_0 = \left[\begin{array}{c} -1 \\ -\left(\mathbf{s}_c\times\mathbf{s}_d\right)^T\mathbf{r} \end{array}\right]\end{split}\]where \(\mathbf{s}_c\) is
scan_center_dir
, \(\mathbf{s}_d\) isscan_dirs
, and \(\mathbf{r}\) is the vector from the observer to the center of the ellipsoid. Once \(\mathbf{p}_0\) is solved for, the limb can be found by solving the quadratic equation\[ad^2+bd+c=0\]where
\[\begin{split}a = \mathbf{p}_h^T\mathbf{A}_C\mathbf{p}_h \\ b = 2\mathbf{p}_0^T\mathbf{A}_C\mathbf{p}_h \\ c = \mathbf{p}_0^T\mathbf{A}_C\mathbf{p}_0 - 1\end{split}\]and \(\mathbf{p}_h=\mathbf{A}_C\mathbf{r}\times\left(\mathbf{s}_c\times\mathbf{s}_d\right)\).
Given the 2 solutions to the quadratic equation, the 2 possible limb points are found by \(\mathbf{p}_0+d\mathbf{p}_h\). The appropriate solution to use is the one which produces a positive dot product with the
scan_dirs
.The returned limbs are expressed as vectors from the observer to the limb point in the current frame.
- Parameters:
scan_center_dir (np.ndarray) – the unit vector which the scan is to begin at in the current frame as a length 3 array
scan_dirs (np.ndarray) – the unit vectors along with the scan is to proceed as a 3xn array in the current frame where each column represents a new limb point we wish to find (should be nearly orthogonal to the
scan_center_dir
in most cases).observer_position (Optional[np.ndarray]) – The location of the observer in the current frame. If
None
then it is assumed the observer is at the origin of the current frame
- Returns:
the vectors from the observer to the limbs in the current frame as a 3xn array
- Return type:
np.ndarray