sorry heres the code with tags:

Code:
void quicksort(vector **parent_vpa, long left, long right, int axis)
{
long i, j;
vector *pivotpoint;
vector *tempstore;

if (left < right)
{
i = left;
j = right;

pivotpoint = parent_vpa[(left+right)/2];

while (i <= j)
{
while (parent_vpa[i]->coord[axis] < pivotpoint->coord[axis])
{
i++;
}

while (parent_vpa[j]->coord[axis] > pivotpoint->coord[axis])
{
j--;
}

if (i <= j)
{
tempstore = parent_vpa[i];
parent_vpa[i] = parent_vpa[j];
parent_vpa[j] = tempstore;
i++;
j--;
}
}

if (left < j)
{
quicksort(parent_vpa, left, j, axis);
}

if (i < right)
{
quicksort(parent_vpa, i, right, axis);
}
}
else
return;
}