home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.graphics
- Path: sparky!uunet!ulowell!img.ulowell.edu!aorenste
- From: aorenste@cs.ulowell.edu (Aaron Orenstein)
- Subject: Re: Simple 3D wireframe rendering method?
- Message-ID: <BzFDqs.ED6@ulowell.ulowell.edu>
- Sender: usenet@ulowell.ulowell.edu (News manager - ulowell)
- Organization: Interactive Media Group - University of Massachusetts at Lowell
- References: <jsm1.724536721@crux1.cit.cornell.edu>
- Date: Thu, 17 Dec 1992 22:42:28 GMT
- Lines: 63
-
- In article <jsm1.724536721@crux1.cit.cornell.edu>, jsm1@crux3.cit.cornell.edu (Solitude Standing) writes:
- -> I am looking for formulae to render a three-dimensional wireframe model
- -> onto a three dimensional screen, with a given rotation about any axis.
- -> Basically I am just looking for the conversion method 3D -> 2D. No
- -> complicated things like hidden surface removal or polygons. Any help
- -> anyone could provide would be great! Thanks.
- ->
- ->
- -> --
- -> Jason Scott MacDonald jsm1@crux2.cit.cornell.edu
- -> "Technology sufficiently advanced is indistinguishable from magic."
- -> - Arthur Charles Clarke
- -> END OF LINE
-
- Rotating points is really quitesimple...
- (From Fundamentals of Interactive Computer Graphics by Foley & Van Damn...)
-
- For every point:
- Treat the point as a matrix [X Y Z W] where W is 1.
-
- To rotate around the Z axis, multiply by the matrix:
- | cos A sin A 0 0 |
- | -sin A cos A 0 0 |
- | 0 0 1 0 |
- | 0 0 0 1 |
-
- (A is the Angle of Rotation)
- (The vertical bars are a sorry way of representing the matrix)
- To rotate around the X axis, multiply by the matrix:
- | 1 0 0 0 |
- | 0 cos A sin A 0 |
- | 0 -sin A cos A 0 |
- | 0 0 0 1 |
-
- To rotate around the Y axis, multiply by the matrix:
- | cos A 0 -sin A 0 |
- | 0 1 0 0 |
- | sin A 0 cos A 0 |
- | 0 0 0 1 |
-
-
- Now, Once you have your rotated points, use the following equation to convert
- it to 2d:
-
- I = XD/(Z/Q) J = YD/(Z/Q)
-
- Where:
- I is the x-coordinate (-F <-> F)
- J is the y-coordinate (-F <-> F)
- D is an arbitrary scaling factor (you pick it)
- Q is the forshortening ratio (you pick it)
- F is an arbitrary bounds (based on your X,Y,Z coords)
-
- You then need to scale and translate the (I,J) points into screen coords
-
- The forshortening ratio represents how "deep" you want the picture. It
- should be between Z and 1. (If it is Z then your picture will be a parallel view)
-
- - Aaron
- --
- --------------------
- "The Code is free, It's the comments that cost a lot..."
- Aaron Orenstein (aorenste@cs.ulowell.edu, 129.63.1.11)
-