Untitled
public text v1 · immutablestatic void VecClipLine3f(float *start, float *end, int axis, float pos)
{
float vec[3], t;
vec[0] = end[0] - start[0];
vec[1] = end[1] - start[1];
vec[2] = end[2] - start[2];
if (vec[axis] == 0.0f) {
printf("bad value for VecClipLine3f!\n");
return;
}
t = (pos-start[axis])/vec[axis];
end[0] = start[0] + vec[0]*t;
end[1] = start[1] + vec[1]*t;
end[2] = start[2] + vec[2]*t;
}