Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Approach to solving Issue #297 #344

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mattderstine
Copy link
Contributor

Pull Request Template

Description

Very rough code to demonstrate the concept for managing the Makie window to display multiple figures with multiple drawings per page. Attempt to address the issue by using CSG to slice the drawings and have separate scenes for the whole, the y cut and x cut. Make the cuts programmable so that other interesting cuts could be used in place of the defaults.

Fixes # (issue)

This is aiming to fix #297 and add some flexible infrastructure for more sophisticated plotting.

Type of change

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • [ x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [x ] This change requires a documentation update

How Has This Been Tested?

This is very preliminary. The file I am using to test this is in the Examples directory. Only the first two figure examples render (but the scene management code isn't perfect). I am stuck on getting the draw_cooketriplet() function to render.

  • Test A
  • Test B

Test Configuration(s):

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@mattderstine
Copy link
Contributor Author

I'm creating this to get comments on the general approach and perhaps some help with my current roadblock. I don't see any easier way to get the proper slices of the 3D drawings. Makie just does projections and will always have problems with concave shapes.

I've added a figure handing system that expands upon one I use for my own plotting in addition to the 3 lscene approach for the original issue. Lots of tweaking of the Makie Layout is needed but this should show the basic functions. I have not idea how this works with pluto as I use VSC and simulate a notebook with cell delimiaters ##. (and that's how the test code is set up).

the lscene swaps don't work properly after I moved them over from my initial stand alone development file. I'm assuming something trivial there. The save screen is enhanced a bit over the original code to avoid overwriting prior save, but I need to figure out how to capture just the working grid rather than the entire screen.

Comments are most welcome and I don't expect them to be quick. This suggestion will take more than a few minutes to evaluate. Thanks!

@mattderstine
Copy link
Contributor Author

I also forgot to fix this before setting up the PR. I added a vanity OpticSim logo on the Makie Display. The file currently needs to be in the root directorty of the "current" project when the example is run. I put it into the Exaxmples folder but it will likely need to be copied for the examples to be run. I haven't bothered to store this in a static place in the project.

@friggog
Copy link
Collaborator

friggog commented Dec 6, 2021

These sound like great changes - could you post some screenshots with examples of the changes here in the PR?

@mattderstine
Copy link
Contributor Author

I'm going to work on fixing the rendering errors before I post the screen shots. This seems to be a bigger issue than I thought and I'd like to make sure I have a solution before asking any one else to spend time on this issue.

@rambunctiousapple
Copy link

rambunctiousapple commented Dec 8, 2021

@mattderstine not sure exactly what functionality you have created but you might want to check out Glimmer.jl, a package written by @galran especially for 3D UI for OpticSim. It's still experimental but much faster than Makie for displaying complicated OpticSim lens assemblies. It's in the Julia registry so you can just add the package to use it.

Maybe there's no overlap but you can judge that quicker than @friggog or I can.

@rambunctiousapple
Copy link

@mattderstine you say you fake a notebook with ## delimiters. Do you use the new Jupyter notebook functionality in VSCode that allows you to have Jupyter notebooks directly in the VSCode IDE?

@mattderstine
Copy link
Contributor Author

@rambunctiousapple, the link I find to Glimmer.jl suggests that it's something else https://github.com/galran/Glimmer.jl. Does the package you describe have a similar name? I'd be happy to check it out.

As to the notebook functionality. I just use the evaluation hotkeys built into the Julia extension for VSC. Shift-enter to evaluate a line and option-enter(at least on the mac) to evaluate the code block between lines starting with ##

Thanks for the suggestions.

@mattderstine
Copy link
Contributor Author

Found it! https://github.com/galran/OpticSimVis.jl. It looks like it uses Glimmer to create a UI around the Makie figures. As such, it might obviate the need for 1/2 of what I am trying to demonstrate, but the basic approach to view the Y & X views would still work. I'll take a look.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2D visualizsation doesn't show concave surfaces correctly
3 participants