I have created a sphere, inside the sphere (cell) is another smaller sphere (nuclei) located at one end and at the other end of the sphere is a structure call microtubules.
The microtubules had a center point and then there are line that extend from the point to the edge of nuclei and also to the edge of the cell.
I have points (viruses) that move throughout the cell. Once the virus is on the microtubules structure ( assuming it attaches to the structure from the cell edge), it must move towards the center of the microtubules and eventually move down the line towards the nuclei.
I have already figured out how to determine if the virus is on the microtubules structure however I cant figure out how to move it down the line. I figured it out in 2D space using the quadrant system, but I cant wrap my head doing it in 3D space.
My question is: Once the virus is on the microtubules how do I update the coordinates to move it towards the center and then towards the nuclei?
What exactly do you have and what exactly do you want? If you have two points A and B then a virus V, starting from point A, at time t will be at point A + (B-A)*t. Is your problem more complex than that?
right now I have the ability to determine if the virus is on the microtubule. The microtubules are straight lines, for example let say the virus is at point x,y,z and then I want to to move it on the line towards the nucleus, the way I did it with 2D was determining which quadrant it and moved it towards the nucleus, however, I cant figure out how to do it with 3D becuase there are now 8 quadrants and 3 different points. the points do not move according to time, if the point is on the microtubules it will move along the microtubules towards the nuclei, I cant figure out how to move it towards the nuclei
3D (as well as 2D) movement is usually represented and calculated using vectors, matrices and linear algebra equations. The equation hamsterman provided is a linear interpolation from a point A to a point B based on the normalized time value for completing this motion, so that t is 0 in the beginning of the movement (and the position coincides with A) and 1 in the end of the movement (and the position coincides with B). So t E [0,1].
If this was a 2D movement, the points would be composed of/defined using two coordinates each (x and y). In 3D, the points are composed of 3 coordinates each ( x, y, and z). If all you want is a linear movement between these points, and your speed is constant, this formula should be sufficient. To get the center of the microtubules, you could calculate the center by :
C(x,y,z) where it's coordinates are
x = (x1+x2+...+xn)/n
y = (y1+y2+...+yn)/n
z = (z1+z2+...+zn)/n
and n is the number of 3D points (representing microtubules) that you want to average and get the central point representing their structure.
To update the coordinates, you can get your directional vector by assigning your current position as A, your goal as B, and calculating the vector B-A. Then you could move in this direction (and on the line this vector is on) by using linear interpolation. Once at B, you could assign a new goal (the nuclei, for instance) and move towards those in the same way.