# Getting the % that a factor gets on a line

Alright, so I obtained 2 factors in 3d room, so they have a x, y, and also z. Currently if the line is y - which I get thus :

```
Vector3 v = new Vector3();
v = a.subtract(b, v);
v.normalizeLocal();
float cosine = (float) v.dot(v);
float angle = (float) Math.toDegrees(Math.acos( cosine ));
```

Now I have a 3rd factor (the c factor), which is inside the line of an and also b. currently I require to recognize just how to get aim an and also b to 0 and also 1, than I require to figure out where c gets on the line. my objective is to have something like c.y = b.y - (a.y * c.x and also c.z is factor on the line (which will be in between 0 and also 1))

So just how do I do this?

I'm not totally certain that this addresses what you are asking - - otherwise, please comment to make sure that I can change it.

If you have 2 factors $A$ and also $B$, the set of factors $P=(1-t)\cdot A+t\cdot B$, where $t$ is an actual number, is the line via $A$ and also $B$, parameterized with $A=P|_{t=0}$ and also $B=P|_{t=1}$.

If you recognize without a doubt that $C$ gets on the line via $A$ and also $B$, after that set $C=(1-t)\cdot A+t\cdot B$ and also address for $t$ in any kind of among the parts (if $C$ remains in reality on the line, after that the value of $t$ will certainly coincide, no matter which part you make use of ; if $C$ is out the line, after that the value of $t$ will certainly not coincide for each and every part).

*note * : modified to deal with formula $P=$ in the 2nd paragraph, and also alike in the 3rd paragraph.

Related questions