From ea9db62c67a3817918e5581b0b1477c9494844f7 Mon Sep 17 00:00:00 2001 From: Andinus Date: Mon, 11 Oct 2021 11:14:35 +0530 Subject: Use plotly basic package, mount with onMount Loading it with meant that it was being fetched everytime user changed the page. Now it'll be bundled with bundle.js and we use onMount to solve it after everything has been loaded/rendered. --- src/algorithms/line-drawing/Bresenham.svelte | 161 +++++++++++++-------------- src/algorithms/line-drawing/DDA.svelte | 130 ++++++++++----------- 2 files changed, 133 insertions(+), 158 deletions(-) (limited to 'src') diff --git a/src/algorithms/line-drawing/Bresenham.svelte b/src/algorithms/line-drawing/Bresenham.svelte index e3eaff1..eb2afd6 100644 --- a/src/algorithms/line-drawing/Bresenham.svelte +++ b/src/algorithms/line-drawing/Bresenham.svelte @@ -1,15 +1,8 @@ - - -

Bresenham

{#if invalidInput === true}

- Slope must be between 0 to 1. + Invalid Input: Slope must be between 0 to 1.

{/if} @@ -84,75 +78,70 @@
-{#if solved === true} -
-

Solution

+
+

Solution

+{#if invalidInput === true} +

+ Inavlid Input: Slope must be between 0 to 1. +

+{/if} + + + + + + + + + + + + + + + + + + + + + + + + + + +
 Value
dx = |x1 - x0|{dx}
dy = |y1 - y0|{dy}
step = |2 * (dy - dx)|{step}
2 * dy{2 * dy}
+ +
+ + Table + - - + + + + + + {#each x_axis as _, i} - - - - - - - - - - - - - - - - - - + + + + + {/each}
 ValueIteration (k)Pkxk + 1yk + 1
dx = |x1 - x0|{dx}
dy = |y1 - y0|{dy}
step = |2 * (dy - dx)|{step}
2 * dy{2 * dy}
p0{p_vals[0]}{i}{p_vals[i]}{x_axis[i]}{y_axis[i]}
+
-
- - Table - - - - - - - - - - - - - {#each x_axis as _, i} - - - - - - - {/each} - -
Iteration (k)Pkxk + 1yk + 1
{i}{p_vals[i]}{x_axis[i]}{y_axis[i]}
-
- -

Graph

- {#if plotlyReady === false} -

- Cannot plot graph: Plotly is not ready. -

- {/if} -{/if} +

Graph