Computer Science 102

Lab 6

In this lab you will augment your vector library with some additional functions. A sample main.c and sample output file are provided for you. These are not guaranteed to represent a complete test of the components. You must use the following matrix structure:

typedef struct matrix_type

{

vec_t row[3];

} mat_t;

Functions that you must provide are:

/**/

/* Compute the outer product of two input vectors */

static inline void vec_cross(

vec_t *v1, /* Left input vector */

vec_t *v2, /* Right input vector */

vec_t *v3); /* Output vector */

/**/

/* project a vector onto a plane */

static inline void vec_project(

vec_t *n, /* plane normal */

vec_t *v, /* input vector */

vec_t *w); /* projected vector */

/* Apply transform matrix to vector */

static inline void vec_xform(

mat_t *m,

vec_t *v1,

vec_t *v2);

/* Compute the transpose of a matrix */

static inline void mat_xpose(

mat_t *m1,

mat_t *m2);

In this lab you will submit a single file, vector.h that includes both your original vector functions and the new ones constructed as part of this lab.

sendlab.102.labsection# lab# vector.h

Mike Westall

2007-01-17T09:19:32