All pastes #746168 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-23 00:22 UTC
rendered paste body
static 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;
}