FitPlaneToPoints for colinear points does not result in 'inconclusive'

If you pass three or more colinear points or points in the same location to Plane.FitPlaneToPoints the FitPlaneResult shows “Success”. Shouldn’t that be “Inconclusive” instead?

from Rhino.Geometry import Plane, Point3d

pts = [Point3d(0,0,0),
       Point3d(1,1,1),
       Point3d(2,2,2)]
fitResult, plane = Plane.FitPlaneToPoints(pts)

print(fitResult)

Hi @trademacher

In any case the plane would be inconclusive/arbitrary as even with points scattered exactly on a plane, the orientation of the X and Y axes (rotation around the Z-Axis) can not be derived from the input points.
So any plane will be arbitrary.

The plane in your example is valid and contains the 3 points.

image

I visualized it with this:

from Rhino.Geometry import Plane, Point3d
import rhinoscriptsyntax as rs

pts = [Point3d(0,0,0),
       Point3d(1,1,1),
       Point3d(2,2,2)]
fitResult, plane = Plane.FitPlaneToPoints(pts)

print(fitResult)

rs.AddPoints(pts)

xid = rs.AddLine(plane.Origin, plane.Origin + plane.XAxis * 10)
yid = rs.AddLine(plane.Origin, plane.Origin + plane.YAxis * 10)
zid = rs.AddLine(plane.Origin, plane.Origin + plane.ZAxis * 10)

rs.ObjectColor(xid, [255, 0, 0])
rs.ObjectColor(yid, [0, 255, 0])
rs.ObjectColor(zid, [0, 0, 255])

Furthermore the method attempts to fit a plane, there is no mention of constructing a plane that contains all input points:

image

from Rhino.Geometry import Plane, Point3d
import rhinoscriptsyntax as rs
import random


pts = [Point3d(random.random(),random.random(),random.random()),
       Point3d(random.random(),random.random(),random.random()),
       Point3d(random.random(),random.random(),random.random()),
       Point3d(random.random(),random.random(),random.random()),
       Point3d(random.random(),random.random(),random.random()),
       Point3d(random.random(),random.random(),random.random()),
       Point3d(random.random(),random.random(),random.random()),
       Point3d(random.random(),random.random(),random.random())]
       
       
fitResult, plane = Plane.FitPlaneToPoints(pts)

print(fitResult)

rs.AddPoints(pts)

xid = rs.AddLine(plane.Origin, plane.Origin + plane.XAxis * 10)
yid = rs.AddLine(plane.Origin, plane.Origin + plane.YAxis * 10)
zid = rs.AddLine(plane.Origin, plane.Origin + plane.ZAxis * 10)

rs.ObjectColor(xid, [255, 0, 0])
rs.ObjectColor(yid, [0, 255, 0])
rs.ObjectColor(zid, [0, 0, 255])

Hi Willem,

thanks for your reply. I total agree with you. As long as you provide three or more points the FitPlaneToPoints method returns a valid and optimal (with respect to points deviation) plane. However, according to the documentation for line-aligned points and points in the same location the PlaneFitResult should be “Inconclusive=1” and not “Success=0”:

So it’s not about the resulting plane. I struggle with the value of the fitResult.

1 Like

Ah I see,

Sorry did not read that documentation well enough.
However the wording “this might happen” indicates to me that it’s not always when points are co-linear but there are situations of co-linear points that trigger an inconclusive return…

I think only a McNeel developer can confirm or deny my conclusion.

-Willem