HollowaySean / BlackHoleViz_v2

Black Hole Visualizer in Unity C#
MIT License
107 stars 11 forks source link

Error in spherical transformation #2

Open jj01101010 opened 3 hours ago

jj01101010 commented 3 hours ago

Hi HollowaySean,

I read your blog post about visualizing Black Holes and read your code. I think I figured out why you have trouble calculating the z component of your direction vector in RelativisticStart.compute (line 107). I think you made an error when calculating the matrix elements of the transformation matrix in line 34. The transformation matrix components from line 41 and 43 should be -origin.z / (rxz rxz) and origin.x / (rxz rxz). This is why you have to square the components in line 107, because the magnitude of origin.xz is sqrt(x^2 + z^2), but the formula states x^2 + z^2.

https://en.wikipedia.org/wiki/Spherical_coordinate_system (see the jacobian matrix J)

jj01101010 commented 3 hours ago

This might also be the reason for your trouble with the numerical errors from the first paper you mentioned, but this is just a guess. I currently try to implement this paper. I will tell you if I figure it out