Dividing line

How would you divide a line that connects two objects into segments.
Like you want to find the midpoint of the line and put a object at that midpoint.
Thanks

If you have both endpoints of the line as vectors, averaging them gets you the midpoint.

Vector3
	begin = new Vector3(1f, 2f, 3f),
	end = new Vector3(10f, 5f, 4f),
	midpoint = (begin + end) / 2f;

If you have a begin, a direction, and a length instead, simply use half the length.

float length = 10f;
Vector3
	begin = new Vector3(1f, 2f, 3f),
	direction = Vector3.up,
	midpoint = begin + direction * length / 2f;

Thanks
Now how about cutting the line into 3rds, 4ths, 5ths…
Thanks

Oh never mind I could just do this.
midpoint = (begin + end) / number;

Thanks