Add reflecting plotter
Browse files
app.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
from backend.nonreflecting_ray_tracing import nonreflecting_plotter
|
|
|
|
| 4 |
|
| 5 |
-
description1 = "A source of light placed at the origin. A spherical non-
|
| 6 |
iface1 = gr.Interface(
|
| 7 |
fn = nonreflecting_plotter,
|
| 8 |
inputs=[
|
|
@@ -13,12 +14,28 @@ iface1 = gr.Interface(
|
|
| 13 |
],
|
| 14 |
outputs="image",
|
| 15 |
live=True,
|
| 16 |
-
title="Non-
|
| 17 |
description=description1,
|
| 18 |
)
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
)
|
| 23 |
|
| 24 |
combinedInterface.launch(share=False)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
from backend.nonreflecting_ray_tracing import nonreflecting_plotter
|
| 4 |
+
from backend.reflecting_ray_tracing import reflecting_plotter
|
| 5 |
|
| 6 |
+
description1 = "A source of light placed at the origin. A spherical non-Reflecting surface placed in front it. This interface simulates the rays interaction with the non-Reflecting surface."
|
| 7 |
iface1 = gr.Interface(
|
| 8 |
fn = nonreflecting_plotter,
|
| 9 |
inputs=[
|
|
|
|
| 14 |
],
|
| 15 |
outputs="image",
|
| 16 |
live=True,
|
| 17 |
+
title="Non-Reflective Ray Tracing",
|
| 18 |
description=description1,
|
| 19 |
)
|
| 20 |
|
| 21 |
+
description2 = "A source of light placed at the origin. A spherical Reflecting surface placed in front it. This interface simulates the rays interaction with the Reflecting surface."
|
| 22 |
+
iface2 = gr.Interface(
|
| 23 |
+
fn = reflecting_plotter,
|
| 24 |
+
inputs=[
|
| 25 |
+
gr.Number(label="Circle Center X (a)", value=20),
|
| 26 |
+
gr.Number(label="Circle Center Y (b)", value=20),
|
| 27 |
+
gr.Number(label="Radius (r)", value=15),
|
| 28 |
+
gr.Slider(minimum=3, maximum=1000, step=1, label="Number of Rays", value=50)
|
| 29 |
+
],
|
| 30 |
+
outputs="image",
|
| 31 |
+
live=True,
|
| 32 |
+
title="Reflective Ray Tracing",
|
| 33 |
+
description=description2,
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
combinedInterface = gr.TabbedInterface([iface1, iface2],
|
| 38 |
+
['Non-Reflective Ray Tracing', 'Reflective Ray Tracing']
|
| 39 |
)
|
| 40 |
|
| 41 |
combinedInterface.launch(share=False)
|