1 Star 0 Fork 15

amylace/python_turtle

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
PendulumExample.pde 1.01 KB
一键复制 编辑 原始数据 按行查看 历史
布树辉 提交于 2022-02-25 13:09 +08:00 . Rearrange dirs
// The Nature of Code
// Daniel Shiffman
// http://natureofcode.com
// Pendulum
// A simple pendulum simulation
// Given a pendulum with an angle theta (0 being the pendulum at rest) and a radius r
// we can use sine to calculate the angular component of the gravitational force.
// Gravity Force = Mass * Gravitational Constant;
// Pendulum Force = Gravity Force * sine(theta)
// Angular Acceleration = Pendulum Force / Mass = gravitational acceleration * sine(theta);
// Note this is an ideal world scenario with no tension in the
// pendulum arm, a more realistic formula might be:
// Angular Acceleration = (g / R) * sine(theta)
// For a more substantial explanation, visit:
// http://www.myphysicslab.com/pendulum1.html
Pendulum p;
void setup() {
size(640,360);
// Make a new Pendulum with an origin position and armlength
p = new Pendulum(new PVector(width/2,0),175);
}
void draw() {
background(255);
p.go();
}
void mousePressed() {
p.clicked(mouseX,mouseY);
}
void mouseReleased() {
p.stopDragging();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/amylace/python_turtle.git
git@gitee.com:amylace/python_turtle.git
amylace
python_turtle
python_turtle
master

搜索帮助