Advanced 3D MathAdvanced Source Code

BM5GL – Robotic Arm 5 Degrees of Freedom in C++ Visual Sudio

Introduction

At the end of 2000 I started this project, since I wanted to develop my own library to draw 3D objects in a simple way, without using third-party libraries, so Kaos 3D Engine was born, a powerful 3D transformations library originally written in C++ and then ported to Flash-Action Script.

To start the project I decided to revive one of the projects that I developed in high school together with a classmate, which was a mechanical arm with 4 degrees of freedom, on that occasion we did it physically with toy parts, and it also had as a base a platform with wheels with its own traction and controlled by remote control.

But on this occasion the project was going to be done virtually and with 5 degrees of freedom, with a fixed base, using 3D mathematical programming, so I began to develop the plans of the project, which would serve to define the vertices of the polygons that would define the object in 3D.

Original drawings of the mechanical arm

Technical aspects

A mechanical arm with 5 degrees of freedom is drawn in 3D, controlled by buttons in the dialog box.

This example, unlike BM2GL, uses 5 subsystems: Base, Forearm, arm, wrist and hand.

The solid structure allows you to hide the non-visible part of the subsystems that is covered by another subsystem, which makes the plotting of the arm look more real. For this, it uses the Ray Tracing technique (vector VS)(Z perspective) and the Cross product for vectors, at certain points where it is doubtful which is ahead or behind.

The CTransformaciones is used which defines the 3D matrix transformations and from 3D to 2D.

The CSubsistema class derived from CTransformations is used to define the 3D geometry of each subsystem that makes up the 3D object, in this case the robotic arm.

BM5GL – Visual C++ version

BM5GL – Flash-ActionScript version

You can download the software executable for FREE from here:

Get the SOURCE CODE of BM5GL and increase your programming experience:

The same program has been developed in 2 different languages: Visual C++ 2017 and Flash-ActionScript.

  • Visual C++ Source Code: Program based on an MFC dialog box, with a standard and easy-to-use interface.
    • How to use the MFC CDialog class to put common controls.
    • It has compilation projects defined for 32 bits and 64 bits.
    • It uses the CTransformations class that defines 3D and 3D to 2D matrix transformations.
    • The CSubsystem class derived from Transformations is used to define the 3D geometry of each subsystem that composes the 3D object, in this case the robotic arm.
    • The solid structure allows to hide the non-visible part of the subsystems that is covered with another
    • subsystems that is covered by another subsystem, which makes the plotting of the arm look more realistic. For this it uses the technique of Ray Tracing (vector VS) (Z-perspective) and the vector product, in certain points where it is doubtful – which one is in front or behind.
  • ActionScript – Flash Source Code: With a fully customized interface and programmed from scratch, using Flash and ActionScript. Currently browsers no longer support flash but you can run the swf using Ruflle.
    • The same mechanical arm with 5 degrees of freedom from the previous project, but this time rewritten in Action Script – Flash

Developed by:

JOSE LUIS DE LA CRUZ LAZARO

YACSHA – Software & Desing, since 1999, Lima – Perú
The World of Chaos – EL MUNDO DEL CAOS – Unlimited Programming

HISTORY

Version 2 – 08-V-2024

  • Porting to VC++ 2017.
  • Added a new icon to the project
  • Add credits and version history
  • Translate GUI from spanish to english
  • Warnings due to lack of static_cast are corrected
  • Rename vcxproj from BrazoMecanico to BM5GL
  • Free movement of subsystems is restricted to avoid unrealistic collisions between subsystems.
  • Optimization of the opening of the HAND, the hand should close only until the fingers collide with the finger above
  • Improvement: It is possible to choose the type of perspective between Isometric (default) and Real. The new “Real” perspective is a conical perspective that draws 3D objects closest to the screen larger, and those further away smaller. This improvementwas added in the Flash version of BM5GL in 2002, but is only now implemented in the Visual C++ version.
  • Comments are added to various parts of the source code (in Spanish)

Version 1 – 14-II-2001

  • First version developed by Yacsha for VC++ 6.0
  • The CSubsystem and Transformations classes were added, as part of my own 3D graphics library, which I named “Kaos 3D Engine”.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button