VECHalfAngle

Syntax

#include <revolution/mtx.h>

void VECHalfAngle ( const Vec* a, const Vec* b, Vec* half );

Arguments

a Pointer to incident Vec. Must point from the light source to the reflection surface. a does not have to be a unit vector.
b Pointer to the line-of-sight Vec. Must point from the eye point to the surface.
b does not have to be a unit vector.
half Pointer to the resulting half-angle unit vector. half points away from the surface in a direction halfway between the light source and the eye point. Acceptable if half = a or half = b.

Return Values

None.

Description

This function calculates the halfway vector found midway between a and b. 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.

a and b 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.

half is calculated as a unit vector located halfway between the light reflecting from the surface and the line-of-sight.

See Also

Vec, VecPtr, VECAdd, VECReflect

Revision History

2006/03/01 Initial version.


CONFIDENTIAL