#ifndef lint
static char *sccsid = "@(#)pointvector.c	1.1 (Steve Hill) 3/9/90";
#endif

/* pointvector.c
 *
 * Miscellaneous routines to manipulate points and vectors.
 */

#include <stdio.h>


#include "basetype.h"
#include "cartesian.h"
#include "matrix.h"
#include "point.h"
#include "vector.h"
#include "pointvector.h"


/* AddVector
 *
 * Adds the vector to point2 to give point1.
 */

point_t *
AddVector(point1, vector, point2)
point_t		*point1, *point2;
vector_t	*vector;
{
	point1->x = point2->x + vector->x;
	point1->y = point2->y + vector->y;
	point1->z = point2->z + vector->z;

	return(point1);
}

/* MakeVector
 *
 * Assigns the vector point1 - point2 into the vector, and normalises.
 */

void
MakeVector(vector, point1, point2)
vector_t	*vector;
point_t		*point1, *point2;
{
	vector->x = point2->x - point1->x;
	vector->y = point2->y - point1->y;
	vector->z = point2->z - point1->z;
	(void) VectorNormalise(vector, vector);
}
