private void MainForm_Load(object sender, EventArgs e)
{
// Ok, let's start to build our virtual robot arm !
model = new DenavitHartenbergModel(new Vector3(0, 0, 0));
// Add the first joint
model.Joints.Add(alpha: 0, theta: Math.PI / 4, radius: 35, offset: 0);
// Add the second joint
model.Joints.Add(alpha: 0, theta: -Math.PI / 3, radius: 35, offset: 0);
// Create the top finger
model_tgripper = new DenavitHartenbergModel();
model_tgripper.Joints.Add(alpha: 0, theta: Math.PI / 4, radius: 20, offset: 0);
model_tgripper.Joints.Add(alpha: 0, theta: -Math.PI / 3, radius: 20, offset: 0);
// Create the bottom finger
model_bgripper = new DenavitHartenbergModel();
model_bgripper.Joints.Add(alpha: 0, theta: -Math.PI / 4, radius: 20, offset: 0);
model_bgripper.Joints.Add(alpha: 0, theta: Math.PI / 3, radius: 20, offset: 0);
// Create the model combinator from the parent model
arm = new DenavitHartenbergNode(model);
// Add the top finger
arm.Children.Add(model_tgripper);
// Add the bottom finger
arm.Children.Add(model_bgripper);
// Calculate the whole model (parent model + children models)
arm.Compute();
// Create the model visualizer
viewer = new DenavitHartenbergViewer(pictureBox1.Width, pictureBox1.Height);
// Assign each projection image of the model to a picture box
pictureBox1.Image = viewer.PlaneXY;
pictureBox2.Image = viewer.PlaneXZ;
pictureBox3.Image = viewer.PlaneYZ;
// Start the animation
timer1.Interval = 40;
timer1.Enabled = true;
}