From 96b82ca335c61203cc63c646eb20f3dd110dcffd Mon Sep 17 00:00:00 2001 From: Andinus Date: Sun, 10 Oct 2021 00:35:01 +0530 Subject: line-drawing/dda: Print chart after solving --- public/global.css | 5 ++ src/algorithms/line-drawing/DDA.svelte | 101 ++++++++++++++++++++++----------- 2 files changed, 74 insertions(+), 32 deletions(-) diff --git a/public/global.css b/public/global.css index 70859df..172d08b 100644 --- a/public/global.css +++ b/public/global.css @@ -126,3 +126,8 @@ tbody tr:nth-child(odd) td, tbody tr:nth-child(odd) th { background-color: var(--bg-dim); } td, th { padding: .25em .5em; border: 1px solid var(--bg-alt); } + +.note { + background-color: var(--cyan-subtle-bg); + padding: 0 0.4ch; +} diff --git a/src/algorithms/line-drawing/DDA.svelte b/src/algorithms/line-drawing/DDA.svelte index b2cc558..fe5e8e5 100644 --- a/src/algorithms/line-drawing/DDA.svelte +++ b/src/algorithms/line-drawing/DDA.svelte @@ -1,6 +1,12 @@ + + +

Digital differential analyzer

-   +   - +
-   +   - +
{#if solved === true && steps > 0}
+

Solution

+
-
+
-
+

-
- - - - - - - - - - - - - {#each x_axis as _, i} +
+ + Table + +
Iterationxyx (plot)y (plot)
+ - - - - - + + + + + - {/each} - - -
{i + 1}{x_axis[i]}{y_axis[i]}{x_axis_floored[i]}{y_axis_floored[i]}Iterationxyx (plot)y (plot)
+ + + + {#each x_axis as _, i} + + {i + 1} + {x_axis[i]} + {y_axis[i]} + {x_axis_floored[i]} + {y_axis_floored[i]} + + {/each} + + + + + + {#if plotlyReady === false} +

+ Cannot plot graph: Plotly is not ready. +

+ {/if} {/if} +
+ -- cgit 1.4.1-2-gfad0