Редактирование: Цилиндр и наклонная плоскость (48.29)
Внимание! Вы не авторизовались на сайте. Ваш IP-адрес будет публично видимым, если вы будете вносить любые правки. Если вы войдёте или создадите учётную запись, правки вместо этого будут связаны с вашим именем пользователя, а также у вас появятся другие преимущества.
Правка может быть отменена. Пожалуйста, просмотрите сравнение версий, чтобы убедиться, что это именно те изменения, которые вас интересуют, и нажмите «Записать страницу», чтобы изменения вступили в силу.
Текущая версия | Ваш текст | ||
Строка 5: | Строка 5: | ||
Используем уравнение Лагранжа 2-го рода: | Используем уравнение Лагранжа 2-го рода: | ||
− | <math>\frac{d}{dt}\left(\frac{\partial L}{\partial\dot q_i}\right) - \frac{\partial L}{\partial q_i} = | + | <math>\frac{d}{dt}\left(\frac{\partial L}{\partial\dot q_i}\right) - \frac{\partial L}{\partial q_i} = 0 , (i = 1,2)</math> , где |
L = T - П - функция Лагранжа | L = T - П - функция Лагранжа | ||
T - кинетическая энергия системы | T - кинетическая энергия системы | ||
П - потенциальная энергия системы | П - потенциальная энергия системы | ||
q - независимые обобщенные координаты | q - независимые обобщенные координаты | ||
− | + | ||
− | В данной задаче в качестве обобщенных координат примем изменяющиеся координату призмы <math>x</math> и координату цилиндра <math>c</math> по оси, направленной вдоль наклонной плоскости <math>\varphi </math>. | + | В данной задаче в качестве обобщенных координат примем изменяющиеся координату призмы <math>x</math> и координату цилиндра <math>c</math> по оси, направленной вдоль наклонной плоскости <math>\varphi </math>. |
Представим: | Представим: | ||
− | <math>T = T_1+T_2</math>, где <math>T_1</math> - кинетическая энергия катка массы | + | <math>T = T_1+T_2</math>, где <math>T_1</math> - кинетическая энергия катка массы m1, а <math>Т_2</math> - треугольной призмы массы m. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Треугольная призма откатывается вдоль оси <math>X</math>, следовательно: | |
− | <math> | + | <math>T_2 = \frac{1}{2}MR^{2}\dot x</math> |
− | + | Движение цилиндра массы m1 плоское. | |
− | + | <math>T_1 = \frac{1}{2}m1V_с^{2}+\frac{1}{4}m1r^{2} ω^{2}</math> | |
− | <math> | + | Где <math>V_с</math> - абсолютная скорость центра масс цилиндра массой m1: |
− | = | + | <math>V_c= \dot S_c \cos - dot x</math> |
− | {{#widget:Iframe |url=http://tm.spbstu.ru/htmlets/VaraevV/mesherskiy/ | + | {{#widget:Iframe |url=http://tm.spbstu.ru/htmlets/VaraevV/mesherskiy/4829.html|width=760 |height=560|border=0 }} |
== Разработка == | == Разработка == | ||
Строка 55: | Строка 37: | ||
<syntaxhighlight lang="javascript" line start="1" enclose="div"> | <syntaxhighlight lang="javascript" line start="1" enclose="div"> | ||
<!DOCTYPE html> | <!DOCTYPE html> | ||
− | + | <html> | |
− | <html> | + | <head> |
− | + | <title>4829</title> | |
− | <head> | ||
− | |||
<script type="text/javascript" src="http://tm.spbstu.ru/htmlets/VaraevV/mesherskiy\three.js"></script> | <script type="text/javascript" src="http://tm.spbstu.ru/htmlets/VaraevV/mesherskiy\three.js"></script> | ||
<script type="text/javascript" src="http://tm.spbstu.ru/htmlets/VaraevV/mesherskiy\OBJLoader.js"></script> | <script type="text/javascript" src="http://tm.spbstu.ru/htmlets/VaraevV/mesherskiy\OBJLoader.js"></script> | ||
Строка 72: | Строка 52: | ||
</style> | </style> | ||
− | </head> | + | </head> |
− | <body> | + | <body> |
− | <div id="Stats-output"> | + | <div id="Stats-output"> |
− | </div> | + | </div> |
− | <div id="WebGL-output"> | + | <div id="WebGL-output"> |
− | </div> | + | </div> |
− | <script type="text/javascript"> | + | <script type="text/javascript"> |
$(function () { | $(function () { | ||
− | + | var a = 0; | |
− | + | var g = 9.8; | |
− | + | var m = 20; | |
− | + | var m1 = 15; | |
− | + | var stats = initStats(); | |
− | + | var scene = new THREE.Scene(); | |
− | + | var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000); | |
− | + | var renderer = new THREE.WebGLRenderer(); | |
− | + | renderer.setClearColor(new THREE.Color(0xEEEEEE, 1.0)); | |
− | + | renderer.setSize(window.innerWidth, window.innerHeight); | |
− | + | renderer.shadowMapEnabled = true; | |
− | + | var spotLight = new THREE.SpotLight( 0xffffff ); | |
− | + | spotLight.position.set( -100, 0, -10 ); //-40, 60, -10 | |
− | + | scene.add(spotLight ); | |
− | |||
− | |||
− | |||
− | |||
var ugol= 135; | var ugol= 135; | ||
var alpha0 = Math.cos(ugol*Math.PI/180); | var alpha0 = Math.cos(ugol*Math.PI/180); | ||
Строка 113: | Строка 89: | ||
cube.position.z=0; | cube.position.z=0; | ||
scene.add(cube); | scene.add(cube); | ||
− | var cylinder1 = createMesh1(new THREE.CylinderGeometry(25, 25, | + | var cylinder1 = createMesh1(new THREE.CylinderGeometry(25, 25, 60, 15, 1)); |
cylinder1.position.x=cube.position.x-400*Math.cos((180-ugol)*Math.PI/180)+25*Math.sin((180-ugol)*Math.PI/180); | cylinder1.position.x=cube.position.x-400*Math.cos((180-ugol)*Math.PI/180)+25*Math.sin((180-ugol)*Math.PI/180); | ||
cylinder1.position.y=cube.position.y; | cylinder1.position.y=cube.position.y; | ||
Строка 129: | Строка 105: | ||
function createMesh0(geom) { | function createMesh0(geom) { | ||
− | + | var meshMaterial = new THREE.MeshNormalMaterial(); | |
− | + | meshMaterial.side = THREE.DoubleSide; | |
− | + | var wireFrameMat = new THREE.MeshBasicMaterial(); | |
− | + | wireFrameMat.wireframe = true; | |
− | + | var plane = THREE.SceneUtils.createMultiMaterialObject(geom, [meshMaterial, wireFrameMat]); | |
− | + | return plane; | |
− | + | } | |
− | + | function createMesh(geom) { | |
− | + | var meshMaterial = new THREE.MeshNormalMaterial(); | |
− | + | meshMaterial.side = THREE.DoubleSide; | |
− | + | var wireFrameMat = new THREE.MeshBasicMaterial(); | |
− | + | wireFrameMat.wireframe = true; | |
− | + | var mesh = THREE.SceneUtils.createMultiMaterialObject(geom, [meshMaterial, wireFrameMat]); | |
− | + | return mesh; | |
− | + | } | |
− | + | function createMesh1(geom) { | |
− | + | var mat = new THREE.MeshNormalMaterial(); | |
− | + | var mesh = new THREE.Mesh(geom,mat); | |
− | + | return mesh; | |
− | + | } | |
− | + | camera.position.x = 0; | |
− | + | camera.position.y = -1300; | |
− | + | camera.position.z = 1500; | |
− | + | camera.lookAt(scene.position); | |
− | + | $("#WebGL-output").append(renderer.domElement); | |
− | + | renderer.render(scene, camera); | |
− | + | var stats = initStats(); | |
− | + | cameraControls = new THREE.OrbitControls(camera, renderer.domElement); | |
− | + | cameraControls.maxDistance = 800; | |
− | + | cameraControls.minDistance = 0.5; | |
− | + | cameraControls.update(); | |
− | + | var controls = new function() { | |
− | + | this.Speed = 0.1; | |
− | + | this.ugol = 135; | |
− | + | this.m = 20; | |
− | + | this.m1 = 15; | |
− | + | this.a='0' | |
− | + | } | |
− | + | var obj = { start_again:function(){ | |
− | + | step=0; | |
− | + | cube.position.x=0; | |
− | + | cube.position.y=0; | |
− | + | cube.position.z=0; | |
− | + | cylinder1.position.x=cube.position.x-400*Math.cos((180-ugol)*Math.PI/180)+25*Math.sin((180-ugol)*Math.PI/180); | |
− | + | cylinder1.position.y=cube.position.y; | |
− | + | cylinder1.position.z=cube.position.z+400*Math.sin((180-ugol)*Math.PI/180)+25*Math.cos((180-ugol)*Math.PI/180); | |
− | + | group1.position.x = 0; | |
− | + | group1.position.y = 0; | |
− | + | group1.position.z=0; | |
− | + | }}; | |
− | + | var gui = new dat.GUI(); | |
− | + | gui.add(controls, 'Speed',0,0.2); | |
− | + | gui.add(controls, 'ugol',89.9999,180); | |
− | + | gui.add(controls, 'm',0.1,50); | |
− | + | gui.add(controls, 'm1',0.1,50); | |
− | + | gui.add(controls,'a').listen(); | |
− | + | gui.add(obj,'start_again'); | |
− | + | var step = 0; | |
− | + | function render() { | |
− | + | cameraControls.update(); | |
− | + | requestAnimationFrame(render); | |
− | + | renderer.render(scene, camera); | |
− | + | step += controls.Speed | |
− | + | ugol = controls.ugol | |
− | + | controls.a=a; | |
− | + | m = controls.m | |
− | + | m1=controls.m1 | |
− | + | if(ugol<=135) { | |
group1.rotation.y=Math.cos(ugol*Math.PI/180); | group1.rotation.y=Math.cos(ugol*Math.PI/180); | ||
− | + | } | |
− | + | else { | |
− | + | group1.rotation.y=Math.cos(ugol*Math.PI/180)+Math.cos((ugol-55)*Math.PI/180); | |
− | + | } | |
− | + | cylinder1.rotation.y = step*step; | |
− | + | a = -(g*m1*Math.sin(2*(180-ugol)*Math.PI/180))/(3*(m1+m)-2*m1*((Math.cos((180-ugol)*Math.PI/180))*(Math.cos((180-ugol)*Math.PI/180)))); | |
− | var v =0. | + | var v =0.6*a; |
− | + | if (cylinder1.position.z<=25*Math.sin((180-ugol)*Math.PI/180)) { | |
− | + | cylinder1.position.x = 25; | |
− | + | cylinder1.position.z = 25*Math.sin((180-ugol)*Math.PI/180); | |
− | |||
cylinder1.rotation.y = 0; | cylinder1.rotation.y = 0; | ||
− | + | group1.position.x =group1.position.x+v; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
else { | else { | ||
− | + | group1.position.x = (a*step*step)/2; | |
cylinder1.position.x=26; | cylinder1.position.x=26; | ||
− | + | cylinder1.position.z=d-g*Math.sin((180-ugol)*Math.PI/180)*step*step/2; | |
− | + | } | |
− | + | } | |
− | + | render(); | |
− | + | function initStats() { | |
− | + | var stats = new Stats(); | |
− | + | stats.setMode(0); // 0: fps, 1: ms | |
− | + | stats.domElement.style.position = 'absolute'; | |
− | + | stats.domElement.style.left = '0px'; | |
− | + | stats.domElement.style.top = '0px'; | |
− | + | $("#Stats-output").append(stats.domElement); | |
− | + | return stats; | |
− | + | } | |
− | + | }); | |
</script> | </script> | ||
</body> | </body> |