Wire frame graphics, how does it work?
science_geek
Posts: 247
I am wondering how a computer program like autocad or solidworks can do wire frame graphics and then be able to rotate the object. My biggest concern is with perception. I know how 2 point perspectives and isometric views can be drawn, but how can they be moved and rotated in "space". Is there some grand algorithm that allows an object to be drawn and then all points are moved? Any info on wire frame graphics is appreciated. My plan is to experiment with the propellor and a display i have lying around to make an uber basic cad program, nothing to fancy...yet.
Comments
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
-Phil
Post Edited (Agent420) : 8/13/2009 8:12:39 PM GMT
this is an interesting subject.
If you've not looked at it yet,·Phil's 3d_graphics.spin file (in the zip in the link above) has some nice, clean examples of matrix transforms.
( @Phil, nice·work·! )
I'd also second Leon's suggestions of using quaternions - they·avoid rotation 'gimble lock' and jumping.· They are actually easier to use than to pronounce. [noparse]:)[/noparse]··
And as Agent420 mentions, you really have the choice of using vectors, matrices, quaternions, or (my favorite) homogeneous cooridinates. Really, under the hood, these critters are nothing more than arrays of numbers with rules (looping algorithms) for adding, multiplying etc. If you want to dig in, read up on all of these. (Homogeneous coords are the hardest to visualize but are essential to projective geometry. When you see an object rotating in 3d on a screen, you are really using projective geo - the focal point is not really the flat screen.)
For simple x,y, and z systems·you have (essentially) 3 dimensions in your array. Quaternions and/or Homogeneous coordinates add more -·I'm fudging a bit·here to keep it simple (Quaternions·use 'complex' numbers, and homogeneous coordinates can have any number of dimensions [noparse][[/noparse]degrees of freedom], with 4 typical for basic projection of 3d objects.)
The trick really is figuring out which of these will best meet your needs - if it's simple motion and the illusion of 3d rotation and depth changes, then study/use Phil's code - at first glance, I'd say his matrix function 'scale' is the one doing the depth changes.· If you need something more sophisticated, you might want to jump right into quaternions and homogeneous coordinates.· Quaternions have been used for > 150 years for representing mechanical motion and in physics extensively.
from Phil's code, line 210, this is a good example of 3 dimensions, 'delta' being change
For a *very nice* software package that can teach us all a thing or two about projective geometry and non-euclidean geometries, take a look at this application:
http://www.cinderella.de/tiki-index.php
Under the hood,·that app is·all done with homogeneous coordinates.
cheers,
- Howard
PS the wiki articles are good, IMO· (When you start to get a headache reading this stuff, just remember it's merely the manipulation of numbers with code!)
http://en.wikipedia.org/wiki/Quaternion
http://en.wikipedia.org/wiki/Projective_geometry
http://en.wikipedia.org/wiki/Homogeneous_coordinates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (CounterRotatingProps) : 8/14/2009 12:40:15 AM GMT
-phar