From e656a48f21305ff139847d256836438cafb14f7d Mon Sep 17 00:00:00 2001 From: Taylor Courage Date: Wed, 3 Jul 2024 00:26:16 -0400 Subject: [PATCH] Initial commit of working product --- README.md | 9 +++++++++ index.html | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ roacalc.css | 36 ++++++++++++++++++++++++++++++++++++ roacalc.js | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 README.md create mode 100644 index.html create mode 100644 roacalc.css create mode 100644 roacalc.js diff --git a/README.md b/README.md new file mode 100644 index 0000000..751700e --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# ROA Calculator + +## Introduction + +This web app is to be used to easily calculate an ROA, useful for single-capstan wire-draw machines to ensure the die(s) used is appropriate for the reduction in area. + +## How it works + +The machine operator simply enters the start and finish size of the material they are drawing. This will display the ROA. \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..baf99ca --- /dev/null +++ b/index.html @@ -0,0 +1,52 @@ + + + + + + + + ROA Calculator + + +
+
+

Taylor Courage's

+

ROA Calculator

+

Use this tool to calculate reduction of area

+
+
+ + + + + + +
+ + +
+ + +   +
+
+
+

Result:

+

--.--%

+
+
+ + + \ No newline at end of file diff --git a/roacalc.css b/roacalc.css new file mode 100644 index 0000000..fb475d5 --- /dev/null +++ b/roacalc.css @@ -0,0 +1,36 @@ + +.content { + position: relative; + border: 1px solid black; + padding-left: 17px; + padding-right: 17px; + max-width: 400px; + min-height: 400px; + margin: auto; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-size: large; +} + +.footer { + position: relative; + bottom: 15px; + width: 100%; + font-size: 75%; + margin: auto; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; +} + +.results { + font-size: 200%; + margin: auto; +} + +.results h1 { + font-family:'Courier New', Courier, monospace; +} + +#vanity { + font-family: serif; + font-style: oblique; + font-size: 0.8em; +} \ No newline at end of file diff --git a/roacalc.js b/roacalc.js new file mode 100644 index 0000000..c43dcdb --- /dev/null +++ b/roacalc.js @@ -0,0 +1,35 @@ +function getROA() { + // Get values from page + var startSize = document.getElementById("startSize").value; + var finalSize = document.getElementById("finalSize").value; + + // If mm is selected we convert it to inches + if (document.getElementById("metric").checked == true) { + startSize = Math.round((startSize * 1000) / 25.4); + } + + // Format our numbers to prevent maximum user stupidity + if (startSize < 1.0 && startSize > 0) { // If we have a 'proper' number i.e. ".130" + startSize = startSize * 1000; + } else { // re-format the number if it's 'wrong' i.e. "130" + startSize = Number(startSize); + } + if (finalSize < 1.0 && finalSize > 0) { // If we have a 'proper' number i.e. ".130" + finalSize = finalSize * 1000; + } else { // re-format the number if it's 'wrong' i.e. "130" + finalSize = Number(finalSize); + } + + // Get area from diameter + var startArea = Math.PI * ((startSize / 2) * (startSize / 2)); + var finalArea = Math.PI * ((finalSize / 2) * (finalSize / 2)); + + // Calculate reduction + var reduction = ((startArea - finalArea) / startArea) * 100; + + // Round to two decimals + reduction = Math.round(reduction * 100) / 100; + + // Display + document.getElementById("result").innerHTML = reduction + "%"; +} \ No newline at end of file