Check if a face is situated on a specific face

And here is a method definition snippet (based on thomthom’s) …

# Test whether the vertex positions of face1 are coplanar with face2,
# within SketchUp’s geometric tolerance.
# @param face1 [Sketchup::Face]
# @param face2 [Sketchup::Face]
# @return [Boolean] True if the two face arguments are coplanar.
def coplanar_faces?(face1, face2)
  face1.vertices.map(&:position).all? { |point|
    point.on_plane?(face2.plane)
  }
end

EDIT: Also note that Thomas previously posted another example from one of his GitHub repos:

1 Like