Edit: a more precise approach would be to use that method to find a plane for the first three points and then use Point3d.on_plane?() to test any other points. Geom.fit_plane_to_points() returns a â€śbest fitâ€ť plane even if the points are not actually co-planar, incontrast to Entities#add_face() which will fail if the points are not co-planar.

https://ruby.sketchup.com/Geom.html A plane can be represented as either an Array of a point and a vector, or as an Array of 4 numbers that give the coefficients of a plane equation.

Letâ€™s assume the pts is an array of point3D and there are minimum 3 points and these are on a plane.
One of the possible definition of plane1:

The #cross (or #*) method is used to compute the cross product between two vectors.

The cross product, also called the vector product, is an operation on two vectors. The cross product of two vectors produces a third vector which is perpendicular to the plane in which the first two lie.

https://ruby.sketchup.com/Geom.html A plane can be represented as either an Array of a point and a vector, or as an Array of 4 numbers that give the coefficients of a plane equation.

Plane (geometry) - Wikipedia Conversely, it is easily shown that if a , b , c and d are constants and a , b , and c are not all zero, then the graph of the equation:

So e.g.:

def plane_as_point_and_vector(plane)
if plane.length == 2
return plane
else
a, b, c, d = plane
normal = Geom::Vector3d.new(a,b,c)
point = ORIGIN.offset(normal.reverse, d)
return [point, normal]
end
end
plane_p_v = plane_as_point_and_vector(plane)
plane_normal = plane_p_v[1]