causticsEngineering icon indicating copy to clipboard operation
causticsEngineering copied to clipboard

Refactoring / rewriting

Open Emmanuel-R8 opened this issue 2 years ago • 4 comments

While keeping the overall structure intact, it is a big refactoring, bordering on rewrite. Given the scope of the changes, no offence taken if it is disregarded.

  • breaking things down in many smaller files.
  • No more x, y. Just row/height. No more flipping of coordinates.
  • A lot of comments to follow the meanings of the various fields / numerical signs. Especially the signs of luminosity excess versus velocity flow. Explanation (after check) of the find_minimum_t function.
  • A lot of vectorisation, which means paying special attentions to matrices sizes (usual posts & fences)
  • Different presentation of the 'divergence of gradient' calculation as a difference of differences instead of the one in the blog post.
  • Quiver plotting and saving still work.
  • Field $\phi$ is reset to mean = 0.0 at each iteration (only its gradient matters). It avoids very high / low values.
  • Clipping the moves of points to a few pixels to avoid unbalanced explosions in one area of the pictures.
  • Generous use of @assert to track unusual situations when debugging. Convergence is fast, so they are not onerous.

Ultimately, the aim is to:

  • be able to raytrace the block.
  • Explore the possibility to get something in colour by having multiple faces and accounting for varying diffractions at varying colour frequencies (use chromatic aberrations to instead avoiding them).
  • Use existing libraries for mesh manipulations.
  • Constrain the optimisation to generate something accounting for the constraints of the CNC (e.g. limit curvature as second-order variations to match the size/shape of the drill).

Emmanuel-R8 avatar Sep 11 '21 11:09 Emmanuel-R8

Changes after testing for non-square images. Plotting defaults to plotting with the same orientation as the original images (fliprc = true means reversing the default flip).

Emmanuel-R8 avatar Sep 13 '21 11:09 Emmanuel-R8

Wow, phenomenal! I'll spend some time testing tonight. This is a huge improvement from what I can see!

MattFerraro avatar Sep 13 '21 16:09 MattFerraro

I still have a sign problem somewhere. Convergence was working well, but not anymore.

Emmanuel-R8 avatar Sep 14 '21 16:09 Emmanuel-R8

Move divergence to maths utilities Further exploration of different halting criteria

Emmanuel-R8 avatar Sep 14 '21 16:09 Emmanuel-R8