How to define the new vector in my case?
This is probably more like a mathematics question:
If I have a vector:
var origin = new Vector(x, y)
then, I would like to get N sub vectors, each one of the N sub vector is got by adding origin
vector with a new vector, like:
subVector = origin.add(new Vector(m, n));
The result I would like to achieve is showing in the image below:
I would like to get N sub vectors which are i开发者_C百科n the same horizontal leve and spaced by "L" length,
My questions are:
1. what is the new vector (Vector(m, n)
) m, n values I should
use to get all the sub vectors ? (N is dynamic value)
I end up with something like:
for(var i=0; i<N; i++){
//But, how to select the m, n value here??
var subVector = origin.add(new Vector(m, n));
}
2. How to choose the new vector (Vector(m, n)
) m, n value to make sure the distance between two neighboring sub vectors is L as showed in the image ?
Because the first of the subvectors can be anything (say v = (v1,v2)), then you need to add to the first subvector to get the others. At each iteration you add the vector (L, 0):
var secondSubvector = firstSubvector.add(new Vector(L, 0))
etc.
Don't you like to have more a point than a vector? I cannot see what you will achieve with it. And if you like to have the same horizontal level you just have have to change the x-axis parameter but not the y in 2D-Space. I guess (!) it's the lenght you have to add to your X-axis parameter:
subVector = new Vector(origing.X + Length, origing.Y)
Let me know if I get you wrong or it helped.
Stef
精彩评论