1. with given vertices in 3D
Reference: BodyFrame.FloorClipPlane Property
"Random sample consensus, or RANSAC, is an iterative method for estimating a mathematical model from a data set that contains outliers. The RANSAC algorithm works by identifying the outliers in a data set and estimating the desired model using data that does not contain outliers."
Ref: Detecting set of planes from point cloud
Given a set of points (3D) this function computes the plane that fits best those points by minimizing the sum of the quadratic distances (perpendicular to the plane) between the plane and the points.
The fit is performed by computing the eigen-values/vectors associated to the distribution of points.
Three points (A,B,C) can define two distinct vectors AB and AC. Since the two vectors lie on the plane, their cross product can be used as a normal to the plane.
Three points will lie on same line if sum of the distance between first and second points, and distance between second and third points, is equal to the distance between first and third point
The projection of a point projPt = (x, y, z)
onto a plane given by a point planePt = (d, e, f)
and a normal n = (a, b, c)
is
projection = projPt - dot(projPt - planePt, n) * n
(This calculation assumes that n
is a unit vector.)
3d math functions provided by Unity