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
- VL: Vertex List, a matrix where each row represents a vertex in 3D space.
- FL: Optional Facet List, used to accelerate the process. If not provided, it defaults to an empty array.
- thre: Optional threshold value, defaulting to 0.01 (1%). It determines the maximum allowable deviation for planarity.
Output Results
- r: Boolean value,
true
if the surface is planar, i.e., if the calculated maximum deviation m
is less than thre
.
- m: The maximum z-value deviation normalized by the number of vertices.
Algorithm Steps
- Initialize
FL
to an empty array. If a second argument is provided and is not empty, assign it to FL
.
- Set
thre
to 0.01. If a third argument is provided and is not empty, assign it to thre
.
- If
VL
is a cell or a structure with a field 'VL', extract VL
and FL
using VLFLofSG
.
- If
FL
is not empty, refine VL
and FL
using VLFLselect
.
- Calculate the normal vector
z
using the cross product of vectors formed by the first three vertices.
- Compute the transformation matrix
T
to align the surface with the xy-plane using Tof2P
.
- Transform the vertex list
VL
using VLtransT
and the matrix T
.
- Calculate
m
as the maximum absolute z-value of the transformed vertices, normalized by the number of vertices.
- Determine planarity by checking if
m
is less than thre
, setting r
accordingly.
- 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