CosmoAI-AES / CosmoSim

Original repo from the BSc project Spring 2022
MIT License
1 stars 3 forks source link

Asymmetric sources are mirrored/rotated badly #132

Closed hgeorgsch closed 1 year ago

hgeorgsch commented 1 year ago

Liten bug: Det ser ut som det er en faktor 2 ute og spasserer i \theta. Triangelet har rotert en hel runde når jeg forandrer theta fra 0 til 180 deg

hgeorgsch commented 1 year ago

Testing on linux, I get only one round on 360°. You have to show me, @kosmoben or post screenshots/-cast.

bdnormann commented 1 year ago

Compare this one (no rotation)

E8AC4A69-6C86-4040-AD1F-27BCD850C377

with this one (180 deg rotation)

53B4AC82-493C-45A6-9406-201FD1A3CAC2

As far as I can understand the right-most pictures should be the same except for a rotaiton around the y-axis. But they are not, as one can see from the green bar. So I suspect there is an extra round of rotation or something (spin-2 quantity rather than spin-1 to put it in physics jargon :D )

bdnormann commented 1 year ago

(At all rather surprised that one seems to get a 45 degree rotation of the image. compared to the source. Perhaps related to the bug?)

hgeorgsch commented 1 year ago

Wrong rotation.

theta is rotation of the source position in polar co-ordinates, and this is correct above. At 0° the source sits to the right, and at 180° at the left, on the x-axis in either case.

To rotate the source around its centre (or reference point), us source rotation.

Does it look right then?

bdnormann commented 1 year ago

Yes, I understand, but it is still wrong in my opinion, as exemplified in the two screen shots above. If you compare the two right-most pictures, the triangle is just shifted to the left in the lower one, compared to the upper one. But that cannot be right, since that does not seem to obey the physical symmetry of the two situations

bdnormann commented 1 year ago

(I mean: if you compare the two left-most pictures, there is a mirror symmetry, so there should be one in the two right-most ones too, since the lens is symmetric)

hgeorgsch commented 1 year ago

Yes. You are right. It has nothing to do with theta though, which has the right effect on the left hand images.

hgeorgsch commented 1 year ago

Main problem was Mat.at( cv::Point2d ) swapping x- and y-coordinates. This has now been fixed on bug/rotation, with some further fixes to Raytrace to make it look right. This causes regression errors, but for the spherical sources, they are relatively minor, and can be put down to numerical errors.