Solved

Posted on 2015-01-09

```
Consider a two dimensional co-ordinate system with two axes; X & Y. This system is identified by positive integer co-ordinates. Meaning, every valid point in this system is represented by two values (x, y) where 0 < x,y <100.
You are given an input set of lines, specified by the co-ordinates of the two end-points.
Write a program to identify all closed shapes created by the specified lines.
Input Format (the program should accept this simple text file called "input.txt" placed in the classpath):
A1, B1; C1, D1
A2, B2; C2, D2
…
An, Bn; Cn, Dn
Expected Output (based on actual values of the input lines):
There are two triangles and 1 square based on the input.
Triangle 1 with vertices (a1,b1; a2, b2; a3,b3)
Triangle 2 with vertices (a5,b5; a6, b6; a7, b7)
Square 1 with vertices (a8, b8; a9, b9; a10, b10; a11, b11)
Note:
The input data may be such that some shapes overlap.
You don't have to find shapes formed by intersection of two shapes. For example, if a square and triangle overlap such that there is another small triangle formed at the intersection, you don't have to report that.
For the sake of scope, report only the following shapes, if any - triangle, any quadrilateral, pentagon.
```

5 Comments

You could then take the triple, quadruple, and pentuple closures of that list.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Title | # Comments | Views | Activity |
---|---|---|---|

Storing historical updates in a database | 9 | 119 | |

How to calculate net price before tax, when only have price after tax? | 10 | 117 | |

STDEVP in SQL | 2 | 53 | |

Segmentation fault (core dumped) error - C program for Binary Search Tree : Level Order Traversal | 2 | 63 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**12** Experts available now in Live!