1
$\begingroup$

(I am applying the things in a software, so I used some programming code, but they are easy to understand I think )

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: enter image description here

I would like to define a algorithm to get N sub vectors which are in the same horizontal level (that's the same Y value) and spaced by "L" length, just like the above image shows.

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

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 ?

2 Answers 2

2

If you know $Y$ then you can just go $-Y$ from the origin, let's call that point $P\, \text{ at }(x,0)$, and check if N is odd or even. If odd then you immediately put a point at P and place $\frac{N-1}{2}$ points to the left or right of that point if even then you place two points further from $P$ with a distance $\frac{L}{2}$, then again place $\frac{N-1}{2}$ points to the left or right. If the whole picture is rotated, then the easiest is again rotate to the case you have drawn and then rotate it back by appyling a rotation matrix to everything and inverse of it.

  • 0
    well, if $P$ has the coordinates $(x,0)$ then the points are $(x\pm L,0)$ right?2011-08-26
1
  1. The 0th value of Vector(m,n) can be anything,
    each subsequent value of Vector(m,n) should be the previous value of Vector(m,n) plus L.

  2. Follow the answer to 1.