OT Z coordinate calculations for graphics

mordred

Member
Join Date
Mar 2004
Location
Red Deer
Posts
1,892
Does anyone have a set of calculations that does not bog down a processor to calculate the x,y coordinates to create the illusion
of a Z coordinate movement for graphical representation?

the Formulas I had used years ago were based on Sine, cos and Tan
in 6 seperate calculations and would literally bog down the processor speeds. I Am working on a C++ program and am trying to provide an accurate representation of a robotic arm for demonstratation.
 
What kind of robot (brand)? If it's a Fanuc robot, I have a rather expensive suggestion...

Another idea, which I learned back in the Atari days, and have since used to speed up PLC code, is to use a look up table (and interpolation between points if necessary), so that instaed of calling trig functions, you are simply looking up stored data in an array.

You can populate the arrays at the beginning of the program, and then just reference them in your program in place of the actual math intensive functions...

Paul
 
I doubt that you need to calculate trig values to make a moving 2D image look like it's moving in 3D. Please describe what you're using and what it's supposed to look like.

mordred said:
Does anyone have a set of calculations that does not bog down a processor to calculate the x,y coordinates to create the illusion
of a Z coordinate movement for graphical representation?

the Formulas I had used years ago were based on Sine, cos and Tan
in 6 seperate calculations and would literally bog down the processor speeds. I Am working on a C++ program and am trying to provide an accurate representation of a robotic arm for demonstratation.
 
The Robot in this case will be a simulation what I am trying to do is set up a software emulation the target is to provide a visual training aid. I may have to go a different route however. I know I had run across the calculations before from an old BASIC graphical gaming book in that book it programmed a cube then as you pressed programmmed keystrokes to shift the Z coordinate it would calculate all the end points change in x,y coordinates to maintain the correct perspective.

I know I had done it with the sine, cos and tan functions before but the copy of the program I had written before is a disntant memory. Unfortunately at the time it would slow down a crash 486 taking usually 10 minutes per shift.
 
The first part of the process has several important variables:
  • X = 758 -- the height of the "world" we're looking at.
  • Y = 1024 -- the width of the world we're looking at
  • Z = 2 -- the depth (front to back) of the world we're looking at
  • Sx = height of our window into the world
  • Sy - width of our window into the world
  • Sz = a depth variable that determines which objects are visible in front of other, hidden objects
  • D = .75 -- the distance between our eye and the window in this imaginary world.

First, we calculate the size of the windows into the imaginary world.

3dgraphics-equation1.gif


Now that the window size has been calculated, a perspective transform is used to move a step closer to projecting the world onto a monitor screen. In this next step, we add some more variables.

3dgraphics-equation2.gif


So, a point (X, Y, Z, 1.0) in the three-dimensional imaginary world would have transformed position of (X', Y', Z', W'), which we get by the following equations:

3dgraphics-equation3.gif
this so far is the only calc's I've found I'll have to try this method
 
this one does work but I've found a slightly faster method from another site that I'm going to use though I'm still trying to understand the Matrix mathematics involved. Here is a sample program I've located on another site if anyone is curious
 
Robotic arm emulations

www.Demo3d.com is a stellar emulation tool for creating emulations on robotic arms. They're some really nice guys too, a small company as well, 4 guys I believe. They'll grant you access to a full trial version for 20 days. The product is called Emulate3D, I've used it a few times but never got the emulation going.

Tell em' Chip sent ya :)

~Chipley
 
Thanks Chipley the site looks good will peruse when I have time pretty much done the initial setup the small class is enjoying the challenge as they are building the stepper motor control circuits on breadboards using address decoders and the 8255 chipset. They have already encountered one of the problems with too much analog circuits interference to the 8086 PC they are programming. I let them struggle with the problem for a bit to see how their troubleshooting skills were developing till I showed them the optical isolators. The students is about 80% done been enjoying the change of pace in teaching too bad I'm only helping the instructor while he's dealing with some family problem.
 
Wow! I wish I had you as a teacher, I could use the knowledge. I'm strugglin' with my first PLC/emulation experience atm, which brings me here. But I'll save the rest for another topic.

Cheers
 
Actually were not using a PLC the boards all interface to an 8086 processor on the IDE slots programmed in assembler which is linked to quick C as the main program, graphics are done in quick basic the course itself is the first year computer electronics which is joined by the telecommunications course and the automation course. For the first year next year they concentrate on their specialties. The instructor wanted a project that would show how all three trades can be involved on the same types of equipment and show the fundamental differents between the three trades.
 

Similar Topics

Hello, I am having an issue trying to get two motors to work in unison, particularly during accel/decel. I have attached a .pdf with the logic...
Replies
14
Views
3,887
Is there anybody who can help me with an example of the coordinate transformations for my 6-axes Manutec R3 robots ? I want to control 2 robots...
Replies
9
Views
2,839
In a safety circuit it's clear how to use sistema or similar to calculate the PL given hardware components. But how are various degrees of pure SW...
Replies
4
Views
84
I know this isn't PLC related, thanks for bearing with me. Does anyone have an excel sheet to calculate full load amps for branch circuits? Im...
Replies
0
Views
701
Has anyone had any experience with calculations for SRML wire. I have searched through all the articles I can, googled it and even talked to...
Replies
4
Views
1,683
Back
Top Bottom