refactor to simplify and avoid slicing risk#220
Conversation
gr5
left a comment
There was a problem hiding this comment.
The code differences seems pretty massive in the diff so I didn't read much of it. Especially since Dale already approved. I did build it and test it and elliptical and circular outlines both still seem to work fine.
|
@gr5 we do not support elliptical outlines. Do we ? So which one do we merge ?
|
|
We do support elliptical outlines I think because we support measuring diagonal mirrors which can be elliptical. Perhaps they don't use the elliptical outline itself but I think they do. See what happens when you set the config to be an ellipse and then drag the horizontal axis or vertical axis to outline something. |
|
I just checked and we do support elliptical outline when testing an ellipse. I think George wrote the json code for that. I think that was the first task I ever assigned to him. That is saving outlines in json. IIRC. |
|
I see. Thank you @githubdoe. |
|
Note to George. Just because I approve something does not mean I checked it very closely. Like I have said recently I don't have a lot of time. In the last case I just decided that since you will check things more than I do it would be ok to approve it since I did not see anything that stood out glaringly. So we sort of created a loop of I don't need to because the other said it was ok. Oh, Oh,. |
|
Yesterday, I was specifically nervous that Julien broke elliptical outlines but like I posted yesterday, I did build this version (this PR) and I did test the elliptical outline feature and it worked fine. I didn't think of saving the wavefront and reading it back in so I'll do that now. I'll also test that mirror config can be saved and loaded and elliptical still works. But I suspect it will be fine. In general, I don't think every line of code needs a detailed code review. Julien has been quite reliable in the past. Usually I look at the code carefully but this time I just tested it by running the program. Because the code changes are only related to outlines I think it's easy enough to do a good test by running the code. Julien did however make a mistake in a zernike formula in one of his PRs and that I looked at very very carefully because that would not be easily caught or noticed by users. Julien caught his own mistake. I would have caught it as well as those were very critical lines of code. |
|
And Dale, if I review and approve the code before you do, you can bet I looked at it extra carefully. If you approve it before I do then I don't look as carefully. You could I suppose mention in the approval comments specifically that you didn't check every line of code. The last few reviews I did look at every line of code. But this one has a lot of changes. |
|
I am a terrible code reviewer and editor. I see what I want to see and not what is really there most of the time. So usually even when I try to be careful you can not trust I got it right. These days I seem to have trouble with understanding gits diff some times as well. What I try to do is understand why the change happened and if the general structure and a few of the lines look like it should correct the problem. But I rarely examine every line. |
|
OK I had a look and circleOutline draws elipses. There are many parts of igramArea which call ellipse things. |

This is same as #218 but full refactor to simplify code at maximum.
Chose pull request that you prefer. #218 is reviewed easier because no code has been displaced. This one is easier to maintain in the futur (unless we want to support ellipses).
If you are interested into clang-format you can look at the effects on https://clang-format-configurator.site/
To actually use it, most modern IDE support it natively.
I did not commit the
.clang-formatfile to the repo so that complete files are not linted automatically whenever you change 1 character in a file. I read it's natively supported in QT Creator.