Interview Question
InternsTeam: mobile engineering
Country: United States
Interview Type: Phone Interview
since we have to enclose all N points, so we can always choose any 5 points in 3-D space (forming prims ) which will enclose all points.
correct me if i am wrong.
the set of k points shud form the vertices of the polygon or 3d figure enclosing all the given set of n points and those k points shud be from the given n points...
In what manner is the enclosing 3d figure to be constructed from the selected k points?
search for extreme set of points on the three axes that is with minimum and maximum x coordinate andd similarly for other two axes. (can be multiple points on a plane)
- words&lyrics July 22, 2012These points will be in 6 different planes each having multiple points ( at faces of cuboid)
Now same problem reduces to finding minimum points in a 2d plane which will enclose all the points in that plane . Now again do similar step that is forming pair of extreme along x and y co-ordinate . These points will be included . For left over points they may or may not be included . They will be included if they don't lie in the existing figure .
This can be checked as follows.
Consider A,B,C,D points (three are already included so check for 4th one if this is already in the figure or not)
D is within ABC if
Area (ABC)= Area(ABD)+AREA(BCD) +AREA(ACD)
If true no need to include . Otherwise include
This can be extended for any number of points