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

Commit

Permalink
Merge branch 'main' into compathelper/new_version/2021-04-22-00-16-12…
Browse files Browse the repository at this point in the history
…-435-763917453
  • Loading branch information
alfredclwong authored Apr 22, 2021
2 parents 1a0407a + 40ecade commit 87ef314
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,51 @@ nothing # hide
```

![Multi-HOE example](assets/hoe_m.png)

## Deterministic Raytracing

```@example
using OpticSim
using OpticSim.GlassCat
using OpticSim.Geometry
using StaticArrays
function stacked_beamsplitters(interfacemode)
bs_1 = leaf(
leaf(
Cuboid(10.0, 20.0, 2.0;
interface = FresnelInterface{Float64}(SCHOTT.N_BK7, Air;
reflectance=0.5, transmission=0.5,
interfacemode=interfacemode)),
rotationX(pi/4)),
translation(0.0, 0.0, -30.0-2*sqrt(2)))
l1 = leaf(SphericalLens(SCHOTT.N_BK7, -70.0, 30.0, Inf, 5.0, 10.0), translation(0.0, -1.34, 0.0))
bs_2 = leaf(
leaf(
Cuboid(10.0, 20.0, 2.0;
interface = FresnelInterface{Float64}(SCHOTT.N_BK7, Air;
reflectance=0.5, transmission=0.5,
interfacemode=interfacemode)),
rotationX(pi/4)),
translation(0.0, 40.0, -30.0+2*sqrt(2)))
l2 = leaf(SphericalLens(SCHOTT.N_BK7, -70.0, 30.0, Inf, 5.0, 10.0), translation(0.0, 40.0, 0.0))
la = LensAssembly(bs_1(), l1(), bs_2(), l2())
detector = Rectangle(20.0, 40.0, SVector(0.0, 0.0, 1.0), SVector(0.0, 20.0, -130.0); interface = opaqueinterface())
CSGOpticalSystem(la, detector)
end
# nondeterministic
Vis.drawtracerays(stacked_beamsplitters(ReflectOrTransmit); trackallrays=true, rayfilter=nothing, colorbynhits=true)
Vis.save("assets/deterministic_trace_1.png") # hide
# deterministic, all beamsplitters transmissive
Vis.drawtracerays(stacked_beamsplitters(Transmit); trackallrays=true, rayfilter=nothing, colorbynhits=true)
Vis.save("assets/deterministic_trace_2.png") # hide
# deterministic, all beamsplitters reflective
Vis.drawtracerays(stacked_beamsplitters(Reflect); trackallrays=true, rayfilter=nothing, colorbynhits=true)
Vis.save("assets/deterministic_trace_3.png") # hide
nothing # hide
```

![Nondeterministic Raytrace](assets/deterministic_trace_1.png)
![Transmission only](assets/deterministic_trace_2.png)
![Reflection only](assets/deterministic_trace_3.png)

0 comments on commit 87ef314

Please sign in to comment.