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 align="left">VECHalfAngle</H1>
12<H2 align="left">C Specification</H2>
13<BLOCKQUOTE><CODE><CODE>#include &lt;revolution/mtx.h&gt;</CODE></CODE></BLOCKQUOTE>
14<BLOCKQUOTE><CODE><CODE>void VECHalfAngle ( const Vec* <EM>a</EM>, const Vec* <EM>b</EM>, Vec* <EM>half</EM> );</CODE></CODE></BLOCKQUOTE>
15<H2 align="left">Arguments</H2>
16<DIV align="left">
17<TABLE border="1" cellpadding="3" cellspacing="0.1">
18  <TBODY>
19    <TR>
20<TD width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>a</EM></STRONG></CODE></TD>
21<TD width="520">Pointer to incident <A href="../structures/Vec_VecPtr.html"><CODE>Vec</CODE></A>.&nbsp;Must point from the light source to the reflection surface.&nbsp;<br><code><em><strong>a</strong></em></code> does not have to be a unit vector.</TD>
22    </TR>
23    <TR>
24<TD width="120" bgcolor="#ffffe8"><CODE><STRONG><EM><em><strong><code>b</code></strong></em>&nbsp;&nbsp;</EM></STRONG></CODE></TD>
25<TD width="520">Pointer to the line-of-sight <A href="../structures/Vec_VecPtr.html"><CODE>Vec</CODE></A>.&nbsp;Must point from the eyepoint to the surface.<br><code><em><strong>b</strong></em></code> does not have to be a unit vector.</TD>
26    </TR>
27    <TR>
28<TD width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>half</EM></STRONG></CODE></TD>
29<TD width="520">Pointer to resultant half-angle unit vector.&nbsp;<code><em><strong>half</strong></em></code> points away from the surface in a direction halfway between the light source and the eyepoint.&nbsp;Acceptable if <code><em><strong>half</strong></em> = <em><strong>a</strong></em></code> or <code><em><strong>half</strong></em> = <em><strong>b</strong></em></code>.</TD>
30    </TR>
31  </TBODY>
32</TABLE>
33</DIV>
34<H2 align="left">Return Values</H2>
35<P align="left">None.</P>
36<H2 align="left">Description</H2>
37<P>This function calculates the vector that is half way between <CODE><EM><STRONG>a</STRONG></EM></CODE> and <CODE><EM><STRONG>b</STRONG></EM></CODE>. This half-angle vector is useful in calculating specular reflections. The reflection from the surface is interpreted as pointing in the same general direction as the line-of-sight. </P>
38<P><CODE><EM><STRONG>a</STRONG></EM></CODE> and <CODE><EM><STRONG>b</STRONG></EM></CODE> do not have to be unit vectors. Both vectors are assumed to be pointing toward the surface from the light source or eyepoint. 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>
39<P><CODE><EM><STRONG>half</STRONG></EM></CODE> is calculated as a unit vector located halfway between the light reflecting from the surface and the line-of-sight. </P>
40
41
42<H2 align="left">See Also</H2>
43<P align="left"><A href="../structures/Vec_VecPtr.html"><CODE>Vec, VecPtr, </CODE></A></P>
44<P align="left"><CODE><A href="VECAdd.html">VECAdd</A>, <A href="VECReflect.html">VECReflect</A></CODE></P>
45<H2>Revision History</H2>
46<P>2006/03/01 Initial version.</P>
47<hr>
48<P>CONFIDENTIAL</p>
49</BODY>
50</HTML>