[C# Helper]
Index Books FAQ Contact About Rod
[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[Beginning Software Engineering]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: Draw a robot arm with a hand that points downward in C#

[Draw a robot arm with a hand that points downward in C#]

The example Draw a simple robot arm with a hand in C# shows how to use transformations to draw a robot arm with a "hand" that opens and closes. See that example for the basic explanation.

If you wanted to pick something up with the hand, then you might want the hand to always point downward. Then the question is, "What angle do you need to give the wrist to make the hand always point down?"

It turns out that this isn't as hard as you might imagine. If the other robot arm joints have angles 0, then the wrist has to have an angle of 90 degrees to point downward. If the other joints don't have angles of 0, then you simply add them to 90 degrees.

The example uses the following code to calculate the wrist angle.

float wrist_angle = 90 + scrJoint1.Value + scrJoint2.Value;

The rest of the program's code is the same as in the same as before. See the previous example for additional details.

Download the example to experiment with it and to see additional details.

© 2009-2022 Rocky Mountain Computer Consulting, Inc. All rights reserved.