Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void GetQuarterArea(int x1, int y1, int x2, int y2,out int quarter,out int quarter2,out int sq1, out int sq2, out int sq3, out int sq4){
- sq1 = 0;
- sq2 = 0;
- sq3 = 0;
- sq4 = 0;
- quarter = 0;
- quarter2 = 0;
- if (x1 > 0 & y1 > 0) quarter = 1;
- if (x1 > 0 & y1 < 0) quarter = 4;
- if (x1 < 0 & y1 > 0) quarter = 2;
- if (x1 < 0 & y1 < 0) quarter = 3;
- if (x2 > 0 & y2 > 0) quarter2 = 1;
- if (x2 > 0 & y2 < 0) quarter2 = 4;
- if (x2 < 0 & y2 > 0) quarter2 = 2;
- if (x2 < 0 & y2 < 0) quarter2 = 3;
- if (quarter == quarter2) sq1 = (x1 - x2) * (y1 - y2);
- else {
- if (quarter == 2 & quarter2 == 4)
- {
- sq1 = (x2 * y1);
- sq2 = (x1 * y1);
- sq3 = (x1 * y2);
- sq4 = (x2 * y2);
- }
- if (quarter == 4 & quarter2 == 2)
- {
- sq1 = (x1 * y2);
- sq2 = (x1 * y1);
- sq3 = (x1 * y2);
- sq4 = (x2 * y2);
- }
- if (quarter == 1 & quarter2 == 3)
- {
- sq1 = (x1 * y1);
- sq2 = (x2 * y1);
- sq3 = (x2 * y2);
- sq4 = (x1 * y2);
- }
- if (quarter == 3 & quarter2 == 1)
- {
- sq1 = (x2 * y2);
- sq2 = (x1 * y2);
- sq3 = (x1 * y1);
- sq4 = (x2 * y1);
- }
- if (quarter == 1 & quarter2 == 2){
- sq1 = (x1 * y1);
- sq2 = (x2 * y2);
- }
- if (quarter == 2 & quarter2 == 1)
- {
- sq2 = (x1 * y1);
- sq1 = (x2 * y2);
- }
- if (quarter == 2 & quarter2 == 3)
- {
- sq2 = (x1 * y1);
- sq3 = (x2 * y2);
- }
- if (quarter == 3 & quarter2 == 2)
- {
- sq3 = (x1 * y1);
- sq2 = (x2 * y2);
- }
- if (quarter == 3 & quarter2 == 4)
- {
- sq3 = (x1 * y1);
- sq4 = (x2 * y2);
- }
- if (quarter == 4 & quarter2 == 3)
- {
- sq4 = (x1 * y1);
- sq3 = (x2 * y2);
- }
- if (quarter == 4 & quarter2 == 1)
- {
- sq4 = (x1 * y1);
- sq1 = (x2 * y2);
- }
- if (quarter == 1 & quarter2 == 4)
- {
- sq1 = (x1 * y1);
- sq4 = (x2 * y2);
- }
- }
- if (sq1 < 0) sq1 = sq1 * (-1);
- if (sq2 < 0) sq2 = sq2 * (-1);
- if (sq3 < 0) sq3 = sq3 * (-1);
- if (sq4 < 0) sq4 = sq4 * (-1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement