Skip to content

Implement bubbles with ratios of indices of refraction and eliminate negative radius spheres #1420

@hollasch

Description

@hollasch

Currently, we implement bubbles (or transparent spheres with non-zero thickness) by specifying an inner sphere of negative radius. It's a hack that works, but creates several geometric issues that then need to be special-cased. Here are some issues dealing with this:

However, there's a much cleaner way to address this. Instead of having dielectric take an index of refraction for the single construction parameter, it should take the ratio of the inner index of refraction over the outer index of refraction. Since air is considered to have an index of refraction of 1.00, the resulting value is the same most materials, where the index of refraction is greater then 1.00. However, this means that bubbles (say of air inside glass) can be specified with a ratio of 1.00 over the index of refraction of the object material (that is, modeling a bubble of air, instead of a bubble of negative glass).

Tests show that the results are identical. To model a hollow glass sphere of non-zero thickness (implicitly filled with air), current code defines an inside sphere as having a negative radius, with an index of refraction of glass. If we change this to have an inside sphere of positive (but smaller) radius, with an index of refraction of 0.67 (= 1 / IOR_glass), then we get identical results. If we follow this approach, then we can eliminate the need to handle or special-case spheres of negative radii.

Before, with negative-radius bubble, IOR of glass:
x_720

After, with positive-radius bubble, IOR of 1/glass:
y_720

(Note that Vassillen Chizhov (@vchizhov) has already made this suggestion parenthetically here: #270 (comment).)

If this work is done, I suggest we either take the absolute value of sphere radii in the constructor, or throw an exception for negative radii or something. Following that, remove the negative-radius hack from the text.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions