Plane Through Points Wish


I think it would be nice to have an option to have a preview that does a “point set deviation” on the select points before the surface/plane is made.

(Pascal Golay) #2

Hi Dennis- since there is, presumably. only one answer to fitting a plane to the points, how would you use this preview?



What I am looking for is whether or not the plane that was created lies on the points or not, and if they don’t I would then need to go back and adjust the points. Currently the only way I could see doing it is create a planer srf through the points. Analyze the points on the surface. Then move the points and created the surface. I thought if in the preview it told you the deviation you could go back and fix the points without have to create a surface first.


Because 3 non-colinear points define a plane, I have only ever used the command with 3 points. It never occurred to me to try more. It sounds, however, as if you want to fit a plane to more than 3 points. Is this correct?

If it is, then you are into the “best-fit” realm where the plane is mathematically calculated to be a best-fit to the set of points by (for example) minimizing the sum of the squares of the distance from each point to the plane. I can’t remember whether Rhino has a command to do that.

If you are only using 3 points, then the plane Rhino makes will go through the 3 points to within the tolerance you have set in the options.


Yes I am using more than 3 points and Rhino does do a best fit for those points, but what would like is feedback on whether surfaces goes through the points. Or guess another way to put is if I have a bunch of points I would like to know if they are planer or not, as we are trying to reverse engineer a model that was sent to us.


You might want to take a look at the PointDeviation command.


Yep that is what I am asking for. As part of the Plane Though points command I would like to see a preview of the deviation without having to create the surface then run the deviation command.


You could try the following script. Can input points or pointclouds. Reports on the command line…


"""Determines if a set of points or pointclouds is planar within tolerance
Script by Mitch Heynick 22 July 2014"""

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

def PointsCoplanarityTest(ptObjs,tol):
    for ptObj in ptObjs:
        if rs.IsPointCloud(ptObj): pts.extend(rs.PointCloudPoints(ptObj))
        else: pts.append(rs.coerce3dpoint(ptObj))
    if len(pts)==0 : return
    if len(pts)<4: return True
    return Rhino.Geometry.Point3d.ArePointsCoplanar(pts,tol*0.5)

def ArePointsCoplanar():
    msg="Select points or pointclouds for planarity test"
    if not ptIDs: return
    msgSuccess="All points are planar within tolerance"
    msgFail="Points are NOT planar within tolerance"
    if len(ptIDs)==3:
        print msgSuccess ; return
    if "PrevUserTolerance" in sc.sticky: prevUTol = sc.sticky["PrevUserTolerance"]
    else: prevUTol = sc.doc.ModelAbsoluteTolerance
    if not uTol: return
    rc = PointsCoplanarityTest(ptIDs, uTol)
    if rc: print msgSuccess
    else: print msgFail
    sc.sticky["PrevUserTolerance"] = uTol



Thanks a bunch that pretty much does what I was looking for.