🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #1409

Re: 3D Rotation

#1409
From: 2fmlcalls
Date: Sat, 06 Apr 1991 02:17
37 lines
2365 bytes
In article <1991Apr05.224711.12750@lynx.CS.ORST.EDU>, murrayk@prism.CS.ORST.EDU writes:
> yin-yang but the rotations are not correct.  They seem to be absolute to
> the screen, not to the actual object.  I have tried every thing I can

I know the problem - I fought with it too.  Basically, you have to set the
origin to the center of your object and rotate it's points about it's own axis
- then with these transformed points, run them through another transformation
matrix that has the 'eye' of the person viewing as the origin.

But how fast do you want the code to run?  I found that pre-rotating your
objects about their own axis in some increment of degrees and storing all the
points in an array makes for some fast lookups.  Given the angle that the
object is rotated from North (or Zenith or some arbitrary global zero) you can
grab the points for that object at said angle - translate them the distance
from the object to the eye (from the origin) and them transform them through
your 'eye's angle from North. 

It's faster (tanslate/rotate once), but the array of points can be a memory
hog.  Of course you can decide on 20 degree increments and decide only to
rotate the object about one axis (as in a BattleZone-like game).  As well, sine
cosine lookups will make calculating your transform matrix quicker.

> think of to remedy this problem, but I have had no luck.  I don't know if
> I am just missing something elemental or if there is actually a big idea
> that I just don't see...
> 
> I would be really happy to hear from anyone with some experience in this
> field about what I am doing wrong.  Thanks a LOT.  This problem has been
> giving me headaches for quite some time now.
> 
> Keith Murray
> CHAOS Software

Well, this atleast is how I've done it.  Perhaps someone knows of an even
quicker method?

john calhoun
Technical Details
Message-ID: <1991Apr5.201714.29494@kuhub.cc.ukans.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!2fmlcalls
References: <1991Apr05.224711.12750@lynx.CS.ORST.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!2fmlcalls
From: 2fmlcalls@kuhub.cc.ukans.edu
Newsgroups: rec.games.programmer,alt.msdos.programmer,comp.os.msdos.programmer
Subject: Re: 3D Rotation
Message-ID: <1991Apr5.201714.29494@kuhub.cc.ukans.edu>
Date: 6 Apr 91 02:17:14 GMT
References: <1991Apr05.224711.12750@lynx.CS.ORST.EDU>
Organization: University of Kansas Academic Computing Services
Lines: 37