#include "shape.h"


int
fvector(double *vertex_pos, int vertice_start, int vertice_end, double *vector_out)
{
	int i;

	for (i = 0; i < 3; i++)
		vector_out[i] = vertex_pos[vertice_end * 3 + i] - vertex_pos[vertice_start * 3 + i];
}

int
fcrossproduct(double *vector_1, double *vector_2, double *vector_out)
{
	vector_out[0] = vector_1[1] * vector_2[2] - vector_1[2] * vector_2[1];
	vector_out[1] = vector_1[2] * vector_2[0] - vector_1[0] * vector_2[2];
	vector_out[2] = vector_1[0] * vector_2[1] - vector_1[1] * vector_2[0];
}

double
fvector_dot(double *vector_1, double *vector_2)
{
	int i;
	double sum;

	sum = 0.;
	for (i = 0; i < 3; i++)
		sum = sum + vector_1[i] * vector_2[i];
	return (sum);
}
