what is the difference between the velocity angle and the acceleration angle of a pendulum
Thank you for your help
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Pendulum here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Pendulum extends Actor
{
private double angle = Math.PI / 2;
private int length;
public Pendulum(int length)
{
this.length = length;
}
/**
* Act - do whatever the Pendulum wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
drawPendulum();
run();
}
public void drawPendulum()
{
GreenfootImage gfim = new GreenfootImage(900,600);
gfim.setColor(Color.WHITE);
gfim.fillRect(0, 0, gfim.getWidth(), gfim.getHeight());
gfim.setColor(Color.BLACK);
int anchorX = gfim.getWidth() / 2, anchorY = gfim.getHeight() / 4;
int ballX = anchorX + (int) (Math.sin(angle) * length);
int ballY = anchorY + (int) (Math.cos(angle) * length);
gfim.drawLine(anchorX, anchorY, ballX, ballY);
gfim.fillOval(anchorX - 3, anchorY - 4, 7, 7);
gfim.fillOval(ballX - 7, ballY - 7, 14, 14);
this.setImage(gfim);
}
public void run()
{
double angleAccel, angleVelocity = 0, dt = 0.5;
angleAccel = -9.81 / length * Math.sin(angle);
angleVelocity += angleAccel * dt;
angle += angleVelocity * dt;
}
}