home *** CD-ROM | disk | FTP | other *** search
- Path: news.eunet.fi!fipnet!kone!jsaarinen
- Newsgroups: comp.sys.amiga.programmer
- X-NewsReader: IntuiNews 1.2b (31.7.94)
- References: <310CC190.78DF@gih.no>
- From: "Jyrki Saarinen" <jsaarinen@kone.fipnet.fi>
- Date: Tue, 30 Jan 96 14:15:08 UT
- Comments: Illegal date header - new date added by quicknews
- X-Original-Date: Tue, 30 Jan 96 09:23:50
- MIME-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-1
- Content-Transfer-Encoding: binary
- Subject: Re: NormalVectors-How to compare angles?
- Message-ID: <38232221@kone.fipnet.fi>
-
-
- > I'm trying to do gouroud shading in assem, and I need a fast way of
- > comparing the vectors, so I can calculate the colors. Is there a faster
- > way of doing this then using normalvectors and comparing them to the
- >ávector from the lightsource (angles between vectors are a shitty job to do
- > (roots and sines) especially in asm). I can fake it if all the surfaces
- >áare the same size, but thats not what I want to do...
-
- Use unit vectors, so that your normal vectors lenght is 1.
- Because of that, the dot product becomes:
-
- cos(a,b) = ax*bx + ay*by + az*bz
-
- Instead of:
-
- cos(a,b) = ax*bx + ay*by + az*bz
- ---------------------
- sqrt(ax*ax+ay+ay*az*az)*sqrt(bx*bx+by+by*bz*bz)
-
- -- _
- a Stellar programmer _ //
- "Amiga - back for the future" \X/
-