ok so i have stored the co-ordinates of a triangle, and what i would like to happen is that as the mouse moves across the screen it would draw a line from the current mouse position to each of the two nearest points of the current triangle, then it would be looped over, so eventually the screen will be filled with lines building together to give the kind of look of the patterns on the processing web banner.
so i was wondering if someone could help me, i cannot work out what the code would be to draw a line from the current mouse position to each of the nearest two of those points of the triangle.
does anyone have any idea? or a link to tutorial that may help me. thanks.
A single triangle or an array of triangle objects?
Assume the case for a single triangle. Use dist() to find the distance from MouseXY to each of the triangle vertices. Eliminate the furthest one using a conditional. Draw lines to the remaining two.
For an array of objects, you'll want to turn your triangle into an object class. Each frame, loop through the array of these objects and perform the operation described above on each object in the array.
It is a duplicate of https://forum.processing.org/topic/help-21-5-2012 with an subject line as useless as the previous one. Try and describe your problem in this subject, it will attract better people interested to help. Imaging if all messages asking for help had similar subjects, it would be a nightmare to find back a given topic!
If you have more information to post on the same topic, do it in the same thread, please. Otherwise, it will dilute information and efforts of those wanting to help.
I won't delete this thread for respect to the response you had, but otherwise I would have done so.