I'm trying to write a program to compute the intersection angle between two sloped lines from a set of data given as an array. There are in total 8 lines making 4 cases to solve.
The array looks like this (well, this is the data table it was made from, the array is just numbers);
But, I know I have to create a loop here... somewhere. I have to calculate the remaining slopes from the data, and then put them through the "if" statement. This is where I become confused!
Hi.
You need to 'step back' from the detail a little, and consider the main steps to do this.
EG:
1) Get coordinates of first pair of lines
2) Calulate Slopes of pair of lines
3) Calculate intersection of pair of lines
4) Repeat for next pair of lines.
You have alredy figured steps 2 & 3 - so all you have to do is write a loop which sets your 'current pair of lines' varaibles, calls the code for slope and intersection, then repeats.
I would make the two calculations functions to make the whole program clearer to read.
Sorry, I'm still lost.
When I'm getting the data is there a special way?
Since I inputted it from a data file in an array form at was I supposed to write it differently?