Test 1 TM3 02 02i

Interaktive Fräsbahn mit Slider

by aaronamran

HTML

<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jsxgraph/distrib/jsxgraphcore.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jsxgraph/distrib/jsxgraph.css">
<div id="jxgbox" class="jxgbox" style="width:500px; height:500px">
</div>
<p id="init">[
 ]
</p>
<p id="data"></p>
<p id="fbd_names"></p>
<script>
        function calculateMaximaData() {
            // Define variables with numerical values (replace with actual values)
            var mm = 0.001;  // Example value for mm

            // Calculate values using Maxima-style expressions
            var vv = Math.floor(Math.random() * 16 + 4) * 100 * mm;
            var rr = Math.floor(Math.random() * 10 + 1) * mm;
            var alpha_deg = (1/2)*(Math.floor(/* Math.random() * */ 5 + 3) * 15);
            var alpha = alpha_deg * Math.PI / 180;
            var tges = (Math.PI / 2) * rr / vv;

            // Calculate other variables using Maxima-style expressions
            var phi_raw = alpha - Math.PI / 2 - (Math.PI / 2) * t / (Math.PI / 2 * rr / vv);
            var phi = alpha - Math.PI / 2 - (Math.PI / 2) * t / tges;
            var at = 0;
            var an = vv * vv / rr;
            var ax = an * Math.max(Math.abs(Math.cos(alpha - Math.PI / 2)), Math.abs(Math.cos(alpha - Math.PI)));
            var ay = an;

            // Calculate values based on Maxima-style expressions
            var p0 = [0, 0];
            var L1 = 3;
            var R = 2;
            var L2 = 1;

            var jphi = alpha < Math.PI / 4 ? alpha + Math.PI / 6 : alpha + Math.PI / 3;
            var jphi_deg = jphi * 180 / Math.PI;

            var x1 = L1 * Math.cos(alpha);
            var xc = x1 + R * Math.sin(alpha);
            var x2 = xc + R * Math.cos(alpha);
            var x3 = x2 + L2 * Math.sin(alpha);

            var y1 = L1 * Math.sin(alpha);
            var yc = y1 - R * Math.cos(alpha);
            var y2 = yc +...

JavaScript

/*
l1: 3;
l2: 2;
l3: 2;

dl: l1*l3/sqrt(l1^2+l3^2)*phi*a;
cE: c*l1^2*l3^2/(l3^2+l1^2)*a^2;
J: m/3*(l1+l2)^2*a^2;
T: float(2*pi*sqrt(J/cE*c/m));

pA: [0,0]; pB: [3, 0]; pC: [l1+l2,0]; pD: [0, l3];
initdata: [
  [ "grid", "","", -1, 6, -1.5, 3, 40 ],
  [ "fix12", "A", [0,0], -90],
  [ "fix12", "", [0, 2], -90],
  [ "beam", "", [0,0], [5,0], 0.13],
  [ "label", "\\(m\\)", [4.5, 0.4] ],
  [ "springt", "c", [0, 2], [3, 0] ],
  [ "node", "B", [3, 0] ],
  [ "rot", "\\varphi", [0,0], [0.4, 0.4], [0.2,-0.8] ],
  [ "moment", "M", [0,0], [1.2, 0.6], [1.2,-0.6] ]
*/


// Start of jsfiddle header.
var mode = "jsfiddle";
var divid = "jxgbox";
var fbd_names = "fbd_names";
var stateRef = "data";
var initstring = document.getElementById("init").innerHTML;
const centeredLabelStyle = {
  size: 0,
  showInfobox: false,
  label: {
    offset: [0, 0],
    anchorX: 'middle',
    anchorY: 'middle'
  }
};

/* 
Fixed GitHub Issues that are implemented in this JS code: 
#11 : Option to lock objects in hidden state (bar, beam, circle, dashpot, fix1, fix12, fix123, fix13, polygon, q, rope, springc, springt, wall)
#12 : Make the beam object clickable
#13 : Suppress infobox at "rot" points
#28 : Move "force" by dragging the vector
#30 : "force": Prevent forces to have zero length
#35 : Make toStack() more robust (cleanupName())
#37 : Grid lines to the background

https://github.com/mkraska/meclib/wiki/Moving-objects-by-scripts
*/

// https://github.com/mkraska/meclib/wiki
// version info
const versionText= "JXG "+JXG.version+" Meclib 2023 08 16";
const highlightColor = "orange";
const movableLineColor = "blue";
const loadColor = "blue";
const defaultMecLayer = 6;
let pxunit = 1/40; // is reset by "grid"
let a = 16*pxunit; // is reset by "grid"
const deg2rad = Math.PI/180, rad2deg = 180/Math.PI;
const tolPointLine = 0.001;
let xscale = 1, yscale = 1; // default scale for infobox, can be modified by "grid"
let dpx = 1, dpy = 1; // default decimal precision for infobox, can be modified by...