Question: Play with Geometric Shapes in 2 D Coordinate System Given two sets of closed geometrical shapes each having a point, a circle, a triangle and

Play with Geometric Shapes in 2D Coordinate
System
Given two sets of closed geometrical shapes each having a point, a circle, a triangle
and a rectangle, find the following:
Question-1: Is the point lie on all closed geometric shapes in set-1?
Question-2: Is the point lie on all closed geometric shapes in set-2?
Question-3: Are alike shapes in set-1 and set-2 intersect?
Question-4: Are shapes in set-1 bigger than set-2?
Note that, all the geometric shapes are filled. This means, if a point is inside a circle
or any other shape, then they are in contact. Similarly, two different radius
concentric circles are also in contact. Just think of filled circle as disk.
Individual display of set-1 and set-2 geometrical objects in 2D coordinate
system:
Set-1:
Set-2:
Display of both sets in one 2D coordinate plane:
Combined:
Programming hints:
The following classes may required:
point
circle
triangle
rectangle
geometry
Input is two copies a point, circle, triangle, rectangle for set-1 and set-2.
A point is defined as P(x,y).
A circle is defined as radius r and center point C(x1,y1).
A triangle is defined as three non collinear points A(x2,y2),B(x3,y3) and C(x4,y4).
A rectangle is defined as two points top left D(x5,y5) and bottom right E(x6,y6).
Note: Assume that rectangle sides are parallel to coordinate axes.
listing them gives: x,y,r,x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6
Input Format:
The first line of input will contain a single integer T, denoting the number of test
cases.
Each test case consists of two lines of input, each line contains 15 values separate
by a space and these two input lines represent the set-1 and set-2 objects.
Output Format:
For each test case, there are six lines of output which described as,
In line-1 print true or false.
In line-2 print true or false.
In line-3 print a boolean array of size 3 separated by space.
In line-4 to 6, print a table of size 3 by 3 adjacent elements are separated by space.
Constraints:
-2000x,y-coordinates of points 2000
0
Play with Geometric Shapes in 2 D Coordinate

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!