extras:codikon:p5js:kythera_berechnungshilfe
Differences
This shows you the differences between two versions of the page.
| extras:codikon:p5js:kythera_berechnungshilfe [2025/11/26 09:13] – created Felix Hardmood Beck | extras:codikon:p5js:kythera_berechnungshilfe [2025/11/26 09:19] (current) – Felix Hardmood Beck | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | Der untere p5.js-Sketch ermöglicht die schnelle Bestimmung der Zahnradparameter, | ||
| + | |||
| + | Das ganze liegt auch auf der ct-lab.info-Webseite: | ||
| + | |||
| + | =====P5.JS===== | ||
| < | < | ||
| Line 45: | Line 50: | ||
| } | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== html ===== | ||
| + | |||
| + | |||
| + | < | ||
| + | |||
| + | < | ||
| + | <html lang=" | ||
| + | < | ||
| + | <meta charset=" | ||
| + | < | ||
| + | <meta name=" | ||
| + | |||
| + | <!-- p5.js library --> | ||
| + | <script src=" | ||
| + | |||
| + | < | ||
| + | body { | ||
| + | font-family: | ||
| + | margin: 20px; | ||
| + | } | ||
| + | # | ||
| + | margin-bottom: | ||
| + | } | ||
| + | label { | ||
| + | display: inline-block; | ||
| + | min-width: 260px; | ||
| + | } | ||
| + | </ | ||
| + | </ | ||
| + | < | ||
| + | |||
| + | < | ||
| + | <p> | ||
| + | Gib einen gewünschten Außendurchmesser < | ||
| + | Der Sketch berechnet daraus die benötigte Zähnezahl < | ||
| + | Der Diametral Pitch < | ||
| + | </p> | ||
| + | |||
| + | <div id=" | ||
| + | |||
| + | <div id=" | ||
| + | <p> | ||
| + | <label for=" | ||
| + | <input id=" | ||
| + | <button id=" | ||
| + | </p> | ||
| + | |||
| + | <p id=" | ||
| + | <p id=" | ||
| + | <p id=" | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | // Fixed Diametral Pitch for Kythera. | ||
| + | // If you want another value, change this constant. | ||
| + | const FIXED_P = 1; // Diametral Pitch | ||
| + | |||
| + | let resultP, resultN, resultOD; | ||
| + | let odInput, calcButton; | ||
| + | |||
| + | function setup() { | ||
| + | // Small canvas; here only to satisfy p5.js. No drawing needed. | ||
| + | const canvas = createCanvas(1, | ||
| + | canvas.parent(" | ||
| + | background(255); | ||
| + | |||
| + | // Get DOM elements that already exist in the HTML. | ||
| + | odInput | ||
| + | calcButton = select("# | ||
| + | resultP | ||
| + | resultN | ||
| + | resultOD | ||
| + | |||
| + | calcButton.mousePressed(calculateGear); | ||
| + | |||
| + | // Initial calculation | ||
| + | calculateGear(); | ||
| + | } | ||
| + | |||
| + | function draw() { | ||
| + | // No continuous drawing required. | ||
| + | } | ||
| + | |||
| + | function calculateGear() { | ||
| + | // Read OD input (mm) | ||
| + | const ODmm = parseFloat(odInput.value()); | ||
| + | |||
| + | if (isNaN(ODmm) || ODmm <= 0) { | ||
| + | resultP.html(" | ||
| + | resultN.html("" | ||
| + | resultOD.html("" | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | const P = FIXED_P; | ||
| + | |||
| + | // Formula: OD = (N + 2) / P (here used numerically in mm with P=1) | ||
| + | // Solve for N: N = OD * P - 2 | ||
| + | const Nraw = ODmm * P - 2; | ||
| + | const N = Math.round(Nraw); | ||
| + | |||
| + | // Recomputed OD based on rounded N | ||
| + | const ODcalc = (N + 2) / P; | ||
| + | |||
| + | // Output | ||
| + | resultP.html(" | ||
| + | resultN.html(" | ||
| + | resultOD.html(" | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | </ | ||
| + | </ | ||
| </ | </ | ||
/var/www/vhosts/ct-lab.info/wiki.ct-lab.info/data/attic/extras/codikon/p5js/kythera_berechnungshilfe.1764148387.txt.gz · Last modified: by Felix Hardmood Beck
