pfVec4(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfVec4(3pf)NAME
pfAddScaledVec4, pfAddVec4, pfAlmostEqualVec4, pfCombineVec4, pfCopyVec4,
pfDistancePt4, pfDotVec4, pfEqualVec4, pfLengthVec4, pfNegateVec4,
pfNormalizeVec4, pfScaleVec4, pfSetVec4, pfSqrDistancePt4, pfSubVec4,
pfXformVec4 - Set and operate on 4-component vectors
FUNCTION SPECIFICATION
#include <Performer/pr.h>
#include <Performer/prmath.h>
void pfAddScaledVec4(pfVec3 dst, const pfVec3 v1, float s,
const pfVec3 v2);
void pfAddVec4(pfVec4 dst, const pfVec4 v1, const pfVec4 v2);
int pfAlmostEqualVec4(pfVec4 v1, const pfVec4 v2, float tol);
void pfCombineVec4(pfVec4 dst, float s1, const pfVec4 v1, float s2,
const pfVec4 v2);
void pfCopyVec4(pfVec4 dst, const pfVec4 v);
float pfDistancePt4(const pfVec4 pt1, const pfVec4 pt2);
float pfDotVec4(const pfVec4 v1, const pfVec4 v2);
int pfEqualVec4(const pfVec4 v1, const pfVec4 v2);
float pfLengthVec4(const pfVec4 v);
void pfNegateVec4(pfVec4 dst, const pfVec4 v);
float pfNormalizeVec4(pfVec4 v);
void pfScaleVec4(pfVec4 dst, float s, const pfVec4 v);
void pfSetVec4(pfVec4 dst, float x, float y, float z, float w);
float pfSqrDistancePt4(const pfVec4 pt1, const pfVec4 pt2);
void pfSubVec4(pfVec4 dst, const pfVec4 v1, const pfVec4 v2);
void pfXformVec4(pfVec4 dst, const pfVec4 v, const pfMatrix m);
typedef float pfVec4[4];
Page 1
pfVec4(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfVec4(3pf)DESCRIPTION
Math functions for 4-component vectors.
pfSetVec4(dst, x, y, z, w): dst[0] = x, dst[1] = y, dst[2] = z, dst[3] =
w . Macro equivalent is PFSET_VEC4.
pfCopyVec4(dst, v): dst = v. Macro equivalent is PFCOPY_VEC4.
pfNegateVec4(dst, v): dst = -v. Macro equivalent is PFNEGATE_VEC4.
pfAddVec4(dst, v1, v2): dst = v1 + v2. Sets dst to the sum of vectors v1
and v2. Macro equivalent is PFADD_VEC4.
pfSubVec4(dst, v1, v2): dst = v1 - v2. Sets dst to the difference of v1
and v2. Macro equivalent is PFSUB_VEC4.
pfScaleVec4(dst, s, v): dst = s * v1. Sets dst to the vector v scaled by
s. Macro equivalent is PFSCALE_VEC4.
pfAddScaledVec4(dst, v1, s, v2): dst = v1 + s * v2. Sets dst to the
vector v1 plus the vector v2 scaled by s. Macro equivalent is
PFADD_SCALED_VEC4.
pfCombineVec4(dst, s1, v1, s2, v2): dst = s1 * v1 + s2 * v2. Sets dst to
be the linear combination of v1 and v2 with scales s1 and s2,
respectively. Macro equivalent is PFCOMBINE_VEC4.
pfNormalizeVec4(v): v = v / length(v). Normalizes the vector v to have
unit length and returns the original length of the vector.
pfXformVec4(dst, v, m): dst = v * m. Transforms v by the matrix m.
pfDotVec4(v1, v2) = v1 dot v2 = v1[0] * v2[0] + v1[1] * v2[1] + v1[2] *
v2[2] + v1[3] * v2[3]. Returns dot product of the vectors v1 and v2.
Macro equivalent is PFDOT_VEC4.
pfLengthVec4(v) = |v| = sqrt(v dot v). Returns length of the vector v.
Macro equivalent is PFLENGTH_VEC4.
pfSqrDistancePt4(v1, v2) = (v1 - v2) dot (v1 - v2). Returns square of
distance between two points v1 and v2. Macro equivalent is
PFSQR_DISTANCE_PT4.
pfDistancePt4(v1, v2) = sqrt((v1 - v2) dot (v1 - v2)). Returns distance
between two points v1 and v2. Macro equivalent is PFDISTANCE_PT4.
pfEqualVec4(v1, v2) = (v1 == v2). Tests for strict component-wise
equality of two vectors v1 and v2 and returns FALSE or TRUE. Macro
equivalent is PFEQUAL_VEC4.
pfAlmostEqualVec4(v1, v2, tol). Tests for approximate component-wise
Page 2
pfVec4(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfVec4(3pf)
equality of two vectors v1 and v2. It returns FALSE or TRUE depending on
whether the absolute value of the difference between each pair of
components is less than the tolerance tol. Macro equivalent is
PFALMOST_EQUAL_VEC4.
Routines can accept the same vector as source, destination, or as a
repeated operand.
SEE ALSO
pfMatrix, pfVec2, pfVec3
Page 3