This question came from our site for professional and enthusiast programmers.

4

This is way too broad of a question. What do you have so far? Have you tried anything? Perhaps you have some code that isn't quite achieving the result you desire but almost?
–
DomenicDattiMay 29 '12 at 15:55

You've got to google around a bit and try it on your own first. SO is not in the business of hand-holding, sorry.
–
SpikeXMay 29 '12 at 15:56

Yes I want the laser to follow a curve. I have been playing around with some code and I can make lasers go in a straight line just fine so far.
–
user1424132May 29 '12 at 17:52

And does it need to go exactly through every point, or would a best-fit curve work?
–
Phillip SchmidtMay 29 '12 at 18:44

Also, do we know anything about the nature of the curve? Is it going to depend on user input? I.e, is the equation of the curve going to be ever-changing? If so, you're fairly screwed here without some extremely complex math.
–
Phillip SchmidtMay 29 '12 at 18:50

no it doesn't have to go through every point. And I have never here of a best fit curve until now. But i'm assuming that it would take the shortest path from start to end.
–
user1424132May 29 '12 at 18:52

Kind of. It's calculated using what called the 'least squares method'. An explanation of that method would be out of the scope of this answer, and it too requires some pretty high-level math (at least in nonlinear situations). Last question: where are you getting the points from? Do you have an equation for them, or are you just coming up with them yourself?
–
Phillip SchmidtMay 29 '12 at 19:02