From e2fee30f901d11d0897655f032539b31758bbc1e Mon Sep 17 00:00:00 2001 From: Andinus Date: Sat, 9 Oct 2021 22:09:29 +0530 Subject: Add working DDA Algorithm --- public/global.css | 22 ++++++- src/algorithms/line-drawing/DDA.svelte | 108 ++++++++++++++++++++++++++------- 2 files changed, 106 insertions(+), 24 deletions(-) diff --git a/public/global.css b/public/global.css index a7545c5..70859df 100644 --- a/public/global.css +++ b/public/global.css @@ -98,13 +98,31 @@ a:visited:hover, a:visited:focus { background-color: var(--cyan-subtle-bg); } -form, input { +form, input, button { color: var(--fg-main); background-color: var(--bg-main); margin: .25em; padding: .25em; + } -input { +input, button { border: 2px solid var(--bg-alt); } + +code { + font-size: 1rem; /* code size should be same as body */ + padding: 0 0.4ch; + color: var(--fg-special-calm); + background-color: var(--bg-alt); +} + +table { + width: 100%; + margin-bottom: 1em; + border-collapse: collapse; +} +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); } diff --git a/src/algorithms/line-drawing/DDA.svelte b/src/algorithms/line-drawing/DDA.svelte index db2070a..b2cc558 100644 --- a/src/algorithms/line-drawing/DDA.svelte +++ b/src/algorithms/line-drawing/DDA.svelte @@ -1,12 +1,47 @@

Digital differential analyzer

@@ -20,24 +55,53 @@   +
+ -
- - -
- - -
- - - -
- - -
- - -
+ +{#if solved === true && steps > 0} +
+ +
+ + +
+ + + +
+ + +
+ + +
+ + + + + + + + + + + + + + {#each x_axis as _, i} + + + + + + + + {/each} + + +
Iterationxyx (plot)y (plot)
{i + 1}{x_axis[i]}{y_axis[i]}{x_axis_floored[i]}{y_axis_floored[i]}
+{/if}