isplanarVLFL

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Geometric Queries
Introduced first in SolidGeometry 3.9, Creation date: 2017-06-25, Last change: 2025-09-14

return whether a point cloud or surface is planar

Description

works with VL or VL/FL

See Also:

Example Illustration

 missing image of isplanarVLFL(VL,FL,thre)

Syntax

[r,m]=isplanarVLFL(VL,[FL,thre])

Input Parameter

VL: Vertex List
FL: optional Facet List to accelerate
thre: Optional threshold; default is 1e-2 ~ 1%

Output Parameter

r: true if planar, i.e. m
m: maximal z value / size(BB)




Copyright 2017-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This function, isplanarVLFL, determines whether a given point cloud or surface is planar. It is part of the SG-Library and was introduced in SolidGeometry 3.9.

Input Parameters

Output Results

Algorithm Steps

  1. Initialize FL to an empty array. If a second argument is provided and is not empty, assign it to FL.
  2. Set thre to 0.01. If a third argument is provided and is not empty, assign it to thre.
  3. If VL is a cell or a structure with a field 'VL', extract VL and FL using VLFLofSG.
  4. If FL is not empty, refine VL and FL using VLFLselect.
  5. Calculate the normal vector z using the cross product of vectors formed by the first three vertices.
  6. Compute the transformation matrix T to align the surface with the xy-plane using Tof2P.
  7. Transform the vertex list VL using VLtransT and the matrix T.
  8. Calculate m as the maximum absolute z-value of the transformed vertices, normalized by the number of vertices.
  9. Determine planarity by checking if m is less than thre, setting r accordingly.
  10. If no output is requested, plot the surface using SGfigure and VLFLplot, setting transparency and annotating with the value of m.
Algorithm explaination created using ChatGPT on 2025-08-19 01:05. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21