title: Density profile integral over line of sight
body: <p>My question is like this:</p>
  
  <p>I know the density as a function of radius for a sphere numerically. Say density rho(1000) and radius(1000) are already calculated numerically. I want to find the integration of the density over a line of sight, as shown below in 2D, although it is a 3D problem:
  <a href="https://i.stack.imgur.com/GNcYU.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GNcYU.gif" alt="enter image description here"></a></p>
  
  <p>This line of sight can move from center to the boundary. I know we need to interpolate the density along the line of sight first, then add together to get the integral of density over the line of sight. But anyone can offer me some idea how to do the interpolation fast? Thank you.</p>