I got a task to write a program that calculates area of convex polygon having only vertex coordinates given as lines for instance:
0 1 1 1 1 1 2 2 2 2 0 3 0 3 0 1
It means that I have four lines:
first line:
x1: 0, y1: 1 | x2: 1, y2: 1
second line:
x1: 1, y1: 1 | x2: 2, y2: 2
third line:
x1: 2, y1: 2 | x2: 0, y2: 3
fourth line:
x1: 0, y1: 3 | x2: 0, y2: 1
All these lines create single convex polygon. There can be more lines. For simplifying it here I assume that lines ALWAYS will connect and create convex polygon.
Program also must be written in MVC patern, catch all errors, there must be user interface, check if lines are connected etc. etc. - not importans staff I can handle all of it with no problem...
The problem is I have no idea what to search for from math perspective... My academic teacher said something about method with "triangles" and that I have to calculate length of each line... but that was all that I got from him and I didn't catch how it can help me ;/
Any ideas how can I use this data to properly calculate area?
I just want to start coding not to reinvent the wheel for another 5 days.
I will really, really appreciate ANY help!