There is another way to get input from the user, and this is mainly through our set of *window* instructions. This instructions allow us to create buttons and input boxes to be able to "react" to the user commands. When you create a new window, a new tab will appear next to the debug tab. Try reading through this example and remember that in the instructions manual you have every eSeeCode term well defined and with more examples. As an important note, the instructions that need to be executed by the button have to go with quotation marks.

Before starting to study the distance between a point and a line, we have to check on how to compute the distance between 2 points. To be able to do it we will use Pythagorean theorem.

In the following example we have created a function that, given the coordinates of the points (a,b) and (c,d), returns the value of the distance. To use something we just learned we will be reading the input from the I/O tab.

When considering the distance between a point and a segment of a line the algorithm complicates. We could compute this distance using mathematics and vectors. The idea would be to find the point in the line with shortest distance and then check if it lies inside our segment.

The technique we will use is based in simulation.

Imagine we have to find the distance between a point (130,80) and the segment between (0,0) and (200, 200).

What we will do is use the coordinate system in eSeeCode. As the segment has a 45 degree angle with the x-axis, we will turn this quantity and then move. At each step we will compute the distance between that point and the point (20,30). To get the coordinates of the point where the guide is we can use the instruction getX() and getY().

For this example we will output the minimum distance between the point and the segment.

In this project we have decided to simulate a robotic arm. This arm has two parts that can be moved by changing their angles. We have included an object that should put a restriction on the arm movement. Although you have the code for almost all the project, you have to complete it. Whenever you see a comment * //Fill this *, it means we took something out from that part. Try to think what needs to be written there and try it. Don't worry, you can execute the program as many times as you need.

Soon we will put the solution to this assignment! Stay tuned!