Giter VIP home page Giter VIP logo

ray-optics's People

Contributors

chengscott avatar cyamahat avatar digitalgreenery avatar dorrington avatar gljames24 avatar glmontanari avatar j3soon avatar kqakqakqa avatar lololchen avatar miguelsanchezp avatar mikiair avatar pfalstad avatar ricktu288 avatar sadajun916 avatar stasfainer avatar sukkaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ray-optics's Issues

Density option for the ruler scale marks and the grid

It would be nice to enhance the ruler and grid tools, by adding the option to set the density of the scale marks and the grid itself (for now there’s only one default density for both).
This could be useful for making more accurate simulations (as I encountered when experimenting with different configurations).

Gaussian beam as a source

Thank you for this great simulator!

Are there any plans of adding a Gaussian beam as a source? I am working with lasers and they all have Gaussian profile, so it would be nice for me to see how they interact with lenses in the simulator.

Sincerely,
valphy

Gradient-index optics

There have been several gradient-index optics examples made by @StasFainer:

They are made by and simulated with brute force stacking of a lot of single-index refractors, so the performance is very poor and a lot of artifacts are generated.

I think there should be a much better and efficient way to simulate them, such as having a tool that takes an arbitrary n(x,y) and simulate by the following:
If a beginning point p1 of a ray is inside the relevant region, then rayIntersection will always return a point p such that the distance between p1 and p is some small distance eps. And then shot will give the best estimation of the new direction of the ray.

However, I am not very familiar with optics higher than the level of freshman physics (my research area is condensed matter theory). So I don't know the proper numerical algorithm to estimate the direction of the ray based on n(x,y) so that the numerical error is minimized. Also, I don't know how to deal with the reflected rays if the function is not smooth in general.

It would be great if someone familiar in this area can create such a tool, or at least provide a proper algorithm.

show the form of the lens

Right now the lenses are just lines. It would be great if the lenses had a more realistic representation.

Adding apertures

Up until now I use two blockers to make a simple aperture. However, it would be great to have some kind of element with a hole that can be symmetrically closed. Dragging the two blockers symmetrically is a pain.

Thank you for the great effort and the nice enhancements! I use your tool very regularly to draw simple setups that would take much more time with Zemax.

Wrong sign in Focal length parameter?

I see ray-optics simulator is using image focal length as parameter for ideal lens and ideal mirrors, but the name of the parameter is "focal length", not "image focal length".

This is confusing especially in ideal mirrors, since mirrors do not have "image focal points", just "focal points":

  • a concave mirror has a negative focal length
  • a convex mirror has a positive focal length
  • see this example for a convex mirror: focal length should be +100, not -100: https://screenrec.com/share/yxwoefucJ9

Could you change the parameter sign for ideal lens and ideal mirrors?

Pencil bending illusion and equidistant 360 degrees point sources

I was wondering about the possibility to add a feature like the “beam”, but instead there would be equidistant 360 degrees point sources along the line. I think this can be used for different scenarios, and in particular for the simple “pencil bending illusion”.
image

Also, in such tool, an option of having the point sources equidistant along a circle could be interesting too, for example to see how such circle transforms under different optical systems, such as an ideal lens, etc.

I also attached two .json files that could be served as a draft for an example of this illusion.
image

json files.zip

Toolbar is not visible while uBlock is active

Due to a ad selector (body > div[id="toolbar"][style]) in uBlock Origin, the toolbar is not visible (displayed as none). I can only see the element optionsbar.

Browser: Chrome 102 on macOS.

refractive index

I cannot see how to set the refractive index. I wish to have a ray pass from air to glass, travel through the glass then pass back out into air. I would also like to pass a ray through a series of materials with different refractive indices. I just cannot see how to set up layers with different refractive indices. Perhaps you could show us with a short video?

Inaccurate sample file descriptions

I'm interested in looking at samples of what this cool simulation can do. I quite like the "Images formed by two mirrors" example (I've sometimes assigned a similar exercise as a homework problem), and "Spherical lens and mirror" is lovely. But the other sample files provided don't seem to match their descriptions at all:

  • "Apparent depth of an object under water" shows instead a few light sources outside of a convex mirror (and their images).
  • "Compound microscope" shows instead the third sample image from the website (a refracting rectangle, a gradient, and a light ray bouncing between a flat and curved mirror), with an extra protractor thrown in.
  • "Reflection and refraction of a single ray" shows instead a point source shining through a slit toward an ideal diverging lens.

Are these files the intended ones?

Menus and Help Button?

This seems to be a great tool. However, it seems that for me (Windows 10, Chrome
Version 98.0.4758.102 (Official Build) (64-bit) ) the Help button and the menus Examples, Mirrors, Glasses are not working.
They have a little folded corner visible indicating that they are probably menus, but clicking on them with any of my three mouse buttons in any single or double click combination I tried seems to have no effect.

Any idea what I might be doing wrong?
I also tried cloning and running it locally, but the effect is the same.
Running it on InternetExplorer is messed up:
image

On Microsoft Edge, I get similar results as on Chrome. Yet, the menus and Help button are also not working.

SVG Export

Adding the possibility to export the scene to vector format such as SVG would be very nice.

amazing work

great work man .. I wanted some thing like this for a while .

add diffuser

Hi, can you please add a model for a diffusing surface?

Extended source

To simulate a lamp, it would be nice to have a source which is extended. So a segment with rays emitted at many angles. This requires a lot of rays to be "accurate", but it would be useful to demo a transmission illumination light path for microscopy.

Implement Beam-Splitter

First of all, Rick, thank you for this awesome tool. I use it quite often to get an impression of my laser beam paths and potential influences of drifts in beam position. For this, it would be nice to feature a beam splitter to see the influence of mirror dealignments at two (or more) different positions.

The easiest (and probably most often used) would be an intensity beam-splitter with an adjustable transmission/reflection ratio. Other ideas would be to implement a polarization option to the light sources and add polarizing beam splitters. Thanks for giving this suggestion a thought!

Tunable point source angle

Now when you select the point source light the rays spread around for 360°, but it would be nice also to choose a narrower emission angle. I think for example 30° or 120° to simulate a lamp source

wrong refraction index for glass on top

I set a half-plane with refractive index = 2.5, and then I put on top a free-shape with refractive index = 1.5
Then, inside the free-shape, the ray refracts as refractive index = 3.75 (not as 1.5)
I checked the effective refractive index is actually the product (3.75=2.5*1.5)

see screen shot: https://screenrec.com/share/PaJxQ45G6U

I think this is wrong because if I need the right refactive angle inside the top glass, in the case above, I have to set a refractive index of 1.5/3.75=0.6 (less than 1 should not be possible)

see screen shot: https://screenrec.com/share/4frvgjD3Bx

If I combine more than 2 glasses, one in top of the other, I checked the effective refractive index is the product of the top two.

Sample files

Anywhere to upload or download user-created files?

Group items in Examples

Currently, the "Examples" list is too long and not organized.

I suggest using nested lists within the example dropdown. The current examples can be organized as follows (contributor in the parenthesis):

Reflection of light

  • images-formed-by-two-mirrors.json (Yi-Ting Tu)
  • parabolic-mirror.json (Paul Falstad)
  • retroreflectors.json (Stas Fainer)
  • maze-solution.json (Stas Fainer)
  • optical-cavity.json (Stas Fainer)
  • penrose-unilluminable-room.json (Vincent Fan)

Refraction of light

  • reflect.json (despite the name, it is more related to refraction) (Paul Falstad)
  • internal-reflection.json (Paul Falstad)
  • prisms.json (Paul Falstad)
  • apparent-depth-of-an-object-under-water.json (Yi-Ting Tu)
  • chromatic-dispersion.json (Yi-Ting Tu)
  • bended-pencil.json (Stas Fainer)
  • broken-pencil.json (Stas Fainer)
  • inferior-mirage.json (Stas Fainer)
  • GRIN-slab.json (Stas Fainer)

Lens

  • concave-lens.json (Paul Falstad)
  • convex-lens.json (Paul Falstad)
  • lens-images.json (Paul Falstad)
  • monochromatic-aberrations.json (Stas Fainer)
  • luneburg-lens.json (Stas Fainer)
  • maxwell-fisheye-lens.json (Stas Fainer)
  • fresnel-lens.json (Stas Fainer)

Combination of Lenses

  • zoom-lens.json (Paul Falstad)
  • compound-microscope.json (Yi-Ting Tu)
  • rochester-cloak.json (Stas Fainer)
  • beam-expanders.json (Stas Fainer)
  • telescope.json (Stas Fainer)

Miscellaneous

  • reflection-and-refraction-of-a-single-ray.json (Yi-Ting Tu)
  • spherical-lens-and-mirror.json (Yi-Ting Tu)
  • NL-simulation.json (Kimmik)

And I think there may be a way to make the addition of new examples to the lists easy.

Weird behavior when moving view

Steps to reproduce the problem:

  • Start from a empty view.
  • Select Beam
  • Mouse down on the canvas, do not release until the cursor is above the Duplicate button.
  • Click the Duplicate button.
  • Click on the canvas again.
  • Now move the view by right mouse button.

Detector Bug

The detector addition is something that I wanted since beginning to use the tool. Very nice addition. However I get this error when using it:

index.js:3361 Uncaught RangeError: toFixed() digits argument must be between 0 and 100
    at Number.toFixed (<anonymous>)
    at Object.draw (index.js:3361)
    at shootWaitingRays (index.js:4336)
    at draw_ (index.js:3977)

It occurs if you try to add a detector when you already have a point source on the canvas or when you change the ray density.

ruler and grid scales

Hi, very nice app,
Would it be possible to allow the user to configure the ruler and the grid scales. That is, the option to choose between centimeters (millimeters), inches and pixels (if possible).

Best regards

Wrong z-index for recently added toolbar lists

The toolbar lists that were added recently (examples, point sources, blockers) always has some kind of z-index issues. Currently, it has been fixed for normal usage, but the issue still exists under some condition, for example, when the width is small:
圖片
Also, I think some code in ToolBarGroup.js should be modified, or add specific instruction for adding new items (e.g. in CONTRIBUTING.md or wiki), to avoid further z-index issue.

Irradiance Map?

Awesome project! Thanks for making such an useful and easy to use tool!

One thing that would make it even more useful is to include the irradiance on a surface. I.e. show a plot of the ray density on a selected surface. Alternately, you could add another linear element called "detector" that does not modify rays, it just provides a plot of the ray density through the line. This would make your project an amazing design tool for lighting applications.

Citation

Hi, I'd like to cite this work and am curious if you have any preference as to how. Thanks.

Moving glass circle, some other stuff

I'm loving this application. Very convenient and very well done.
I have a few comments, most of which minor:

  • x Creating a glass circle and then moving it, resizes the circle to the origin point. It would be better if the circle doesn't resize at all. It may be that I am unaware of a key combo?
    Edit: I see now that the circle has two dots. I didn't see the dark purple dot at first.
    Edit: Grabbing the edge of things moves them. That makes sense.
  • I am missing a feature that allows to pass the ray through a filter (for example rainbow), so you can keep better track of how the rays flow. This would benefit me greatly.
  • Not really bothersome, but the save function is missing an extension
  • Some small text at the bottom with the coordinates of the selected item. You can use the ruler now, but it just seems some coordinates (and mouse coordinates) could be more convenient.
  • x I am unable to move a custom shaped lens. I was expecting a point in the middle to drag it.
  • Overall the UI could need some work. Or a bit more extensive manual would already help a great deal for new users.

Overall, this is awesome. Hats off.

Opening image in background

Great App,
would it be possible to open an image in the background so we can use it as reference when creating the lenses. So the background image is my template product that will hold the lense and light sourse.

Thanx

Surface Roughness

I'm really full of awe of this application. I put together a quick demonstration in 30 minutes of 3 different theories and sent them off which would have otherwise taken me ... I'm not even sure at this point.

Is there a way to simulate surface roughness or anything less than perfect reflectance? Surface roughness?

I'm trying to create JSON files directly to make my editing better, but it makes it harder to work if I make a jaggy (Triangle or Sawtooth) mirror surface :)

Glass circle changes to a circle filled with different medium

I am working on a project where we need to know the glare points location on a soap bubble (soap skin but air inside the bubble). When the light sources are in different positions, the glare points are expected to show up in different places on the bubble. In the current application, I could only put a glass circle but the refractive index of the glass is not close to the refractive index of the air, therefore I am not able to obtain what I want.
Could users set the medium of the glass circle, for example, make it an air circle.

ovals

very useful tool you have here - would there be a way to add an oval lens in addition to the circular one? I understand your time is limited, but can't hurt to ask :)

Ideal Glass

Circle Glass (type circlelens) is not fit to practice spherical refractive surface equation:
f/s+f'/s'=1
being s and s' the distance from origin for object and image; f the focal length and f' the image focal length, respectively.
Distances are measured from origin (positive on the right, negative on the left).

I propose a new type, named Ideal Glass, with 2 parameters: n=refractive index and R=curve radius.

Focal length (f) and image focal length (f') can be calculated internally as:
f=-R/(n-1)
f'=R*n/(n-1)

Simulation and representation would be the same as ideallens. The only change being to represent 2 different focal points and to ask for 2 parameters input entries (n=refractive index and R=curve radius).

This could be a new menu item at Glasses labeled as: Ideal Glass.

Even better, I would suggest a new menu item header labeled "Ideal Curved", including:

  1. Ideal Curved Glass.
  2. Ideal Curved Mirror (change name from Ideal Curved to Ideal Curved Mirror and move from Mirrors menu item).
  3. Ideal Spherical Lens (move from Glasses menu item, see issue #42).

Ideal Spherical Lens

Sphericallens are not fit to practice the lensmaker's equation: 1/focal length = (refractive index -1)*(1/R1 - 1/R2)
I would like a new kind of Sphericallens, type named as IdealSphericallens, in order to simulate the lensmaker's equation.
Simulation and representation would be the same as ideallens. The only change would be on parameters input entries: n=refractive index; R1= curve radius for the left surface; R2= curve radius for the right surface. Focal length can be calculated internally using lensmaker's equation.
This could be a new item at Glasses menu labeled as: Ideal Spherical Lens.

Allow setting color of light sources

It would be very helpful in certain situations if it were possible to set the color of a light source (and therefore the representation of its rays), so that it is possible to discern rays from different sources once they start to overlap.

Metric units

Is it possible to set ruller units to milimeters or centimeters? If not, can it be done?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.