← 返回 tesla 的题目列表Detect the Dominant Plane and Outlier Points in 3D
类型:online_judge
Problem: Detect the Dominant Plane and Outlier Points in 3D
You are given n 3D points. Around 70% of the points lie on the same plane, while the remaining points are from other objects or noise.
Find the dominant plane and output the indices of points whose distance to that plane is greater than the given threshold.
The plane is represented as:
a*x + b*y + c*z + d = 0
To make the output deterministic, the plane parameters must satisfy:
sqrt(a^2 + b^2 + c^2) = 1
The first coefficient among (a, b, c) whose absolute value is greater than 1e-9 must be positive
Print a b c d rounded to 6 decimal places
Input Format
n threshold
x0 y0 z0
x1 y1 z1
...
x(n-1) y(n-1) z(n-1)
Point indices are 0-based.
Output Format
a b c d
k
idx1 idx2 ... idxk
Where:
The first line contains the normalized dominant plane parameters
The second line contains the number of outlier points k
The third line contains all outlier indices in ascending order; print an empty line if there are no outliers
Constraints
3 <= n <= 150
0 < threshold <= 10
Coordinates are real numbers with absolute values at most 10^6
There is guaranteed to be at least one plane with more than half of the points within distance threshold
NumPy is allowed
Example
Input:
5 0.1
0 0 0
1 0 0
0 1 0
1 1 0
0 0 5
Output:
0.000000 0.000000 1.000000 -0.000000
1
4
Example
Input
5 0.1
0 0 0
1 0 0
0 1 0
1 1 0
0 0 5
Output
0.000000 0.000000 1.000000 -0.000000
1
4