Compare commits
No commits in common. "32e10a3cf4516858dff0d62be9dfe52ef900a4eb" and "23b48709db7d3221d7482a280804eab1f6e765d1" have entirely different histories.
32e10a3cf4
...
23b48709db
Binary file not shown.
Before Width: | Height: | Size: 2.0 MiB |
8
main.js
8
main.js
@ -1,9 +1,5 @@
|
||||
import { Resistor, SeriesResistor, ParallelResistor } from './modules/resistors.js';
|
||||
|
||||
window.Resistor = Resistor
|
||||
window.SeriesResistor = SeriesResistor
|
||||
window.ParallelResistor = ParallelResistor
|
||||
|
||||
var resistorValues = [100, 1000]
|
||||
var N = 4
|
||||
var maxValue = Math.max(...resistorValues)
|
||||
@ -45,7 +41,6 @@ console.log(`Parameters: N = ${N}, values = ${resistorValues} `);
|
||||
for (i = 0; i < N; i++)
|
||||
bottomUpDP();
|
||||
console.log("Finished computation of DP array");
|
||||
window.numberline = numberline
|
||||
|
||||
function missings() {
|
||||
var missing = new Set()
|
||||
@ -57,3 +52,6 @@ function missings() {
|
||||
}
|
||||
console.log(`We found a composite resistor for every value in the range [1, ${N * maxValue + 1}] but for: ${[...missings()].join(",")}`)
|
||||
|
||||
numberline[420].draw() // Draw the Resistor diagram for 420 Ohm as SVG
|
||||
|
||||
console.log(numberline)
|
||||
|
@ -35,7 +35,7 @@ class Resistor {
|
||||
var [width, height] = [50, 100]
|
||||
return [svg, width, height]
|
||||
}
|
||||
draw(element = document.getElementsByTagName("body")[0]) {
|
||||
draw() {
|
||||
var [svg, width, height] = this.getSVG();
|
||||
var maxHeight = height + 2*25
|
||||
var maxWidth = width
|
||||
@ -47,7 +47,7 @@ class Resistor {
|
||||
${svg}
|
||||
</g>
|
||||
</svg>`
|
||||
element.innerHTML += thesvg;
|
||||
document.getElementsByTagName("body")[0].innerHTML = thesvg;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user