1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<TITLE>VECHalfAngle</TITLE> 9</HEAD> 10<BODY> 11<H1>VECHalfAngle</H1> 12 13<H2>Syntax</H2> 14<dl><dd><pre class="construction"> 15#include <revolution/mtx.h> 16 17void VECHalfAngle ( const Vec* a, const Vec* b, Vec* half ); 18</pre></dd></dl> 19 20<H2>Arguments</H2> 21<TABLE class="arguments" border="1" > 22 <TBODY> 23 <TR> 24<TH>a</TH> 25<TD>Pointer to incident <A href="../structures/Vec_VecPtr.html"><CODE>Vec</CODE></A>. Must point from the light source to the reflection surface. <SPAN class="argument">a</SPAN> does not have to be a unit vector.</TD> 26 </TR> 27 <TR> 28<TH>b</TH> 29<TD>Pointer to the line-of-sight <A href="../structures/Vec_VecPtr.html"><CODE>Vec</CODE></A>. Must point from the eye point to the surface.<br><code><em><strong>b</strong></em></code> does not have to be a unit vector.</TD> 30 </TR> 31 <TR> 32<TH>half</TH> 33<TD>Pointer to the resulting half-angle unit vector. <code><em><strong>half</strong></em></code> points away from the surface in a direction halfway between the light source and the eye point. Acceptable if <SPAN class="argument">half</SPAN> = <SPAN class="argument">a</SPAN> or <SPAN class="argument">half</SPAN> = <SPAN class="argument">b</SPAN>.</TD> 34 </TR> 35 </TBODY> 36</TABLE> 37 38<H2>Return Values</H2> 39<P>None.</P> 40 41<H2>Description</H2> 42<P>This function calculates the halfway vector found midway between <SPAN class="argument">a</SPAN> and <SPAN class="argument">b</SPAN>. This halfway vector is useful in when calculating specular reflections. The halfway vector is interpreted as pointing in the general direction of the line-of-sight from the surface off which light is reflecting.</P> 43<P><SPAN class="argument">a</SPAN> and <SPAN class="argument">b</SPAN> do not have to be unit vectors. Each of them is assumed to be pointing at the surface from the light source or line-of-sight direction. Local copies of these vectors are positively/negatively reversed and normalized, and the head of one vector is connected to the tail of the other.</P> 44<P><SPAN class="argument">half</SPAN> is calculated as a unit vector located halfway between the light reflecting from the surface and the line-of-sight.</P> 45 46<H2>See Also</H2> 47<P class="reference"> 48<A href="../structures/Vec_VecPtr.html">Vec, VecPtr</A>, 49<A href="VECAdd.html">VECAdd</A>, 50<A href="VECReflect.html">VECReflect</A> 51</P> 52 53<H2>Revision History</H2> 54<P> 552006/03/01 Initial version. 56</P> 57 58<hr><p>CONFIDENTIAL</p></body> 59</HTML>