line "growing" through vertex points

edited January 2016 in How To...

Hi all, what I would like to do is to generate a number of vertexes (4 for example) in random positions and then having a line starting from one vertex that "grows" intersecting the other vertex points. Do you think is possible? What is important is that I only want to have 1 continuous line..

thank you

P.

Tagged:

Answers

  • You will generate a random number n, the amount of vertices, and then n pairs of x and y. You will store those values in an array (2D maybe) and calculate the line equation for the first two vertices. This line will start from vertice #1 and elongate until it reaches vertice #2. Then calculate the line equation for vertice #2 & #3 and repeat until vertice #n

  • edited January 2016

    yes, like Alex said; for elongate look at lerp()

    the array is of type PVector and quite surely 1D

    this

    calculate the line equation for the first two vertices.

    is not necessary with lerp imho

  • I did not know about lerp... Nice

Sign In or Register to comment.