Syntax
TR2=TRofCPL(CPL)
Input Parameter
Output Parameter
Examples
TRofCPL(CPLsample(16))
Copyright 2019-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, TRofCPL
, is designed to perform a 2D triangulation of a closed polygon list (CPL). It is part of the SG-Library and was introduced in SolidGeometry 4.7 by Tim Lueth.
Input Parameters
- CPL: A closed polygon list, which is a set of points defining the boundary of a polygon.
Output Results
- TR2: A 2D triangulation object that represents the triangulated version of the input polygon.
Algorithm Steps
- The function begins by calling
PLELofCPL(CPL)
, which processes the closed polygon list (CPL) to generate two outputs:
- PL: A list of points that define the vertices of the polygon.
- EL: A list of edges that connect the points in the polygon.
- Next, the function uses the
delaunayTriangulation
function with the points list (PL) and edges list (EL) to create a 2D triangulation object, TR2
.
- If no output is requested (i.e.,
nargout==0
), the function proceeds to visualize the triangulation:
- It opens a new figure using
SGfigure
and sets the view to a top-down perspective with view(0,90)
.
- The function plots the triangulation using
VLFLplot
, displaying the points and connectivity list of the triangulation.
- It identifies the interior triangles using
isInterior(TR2)
and plots them in green.
- Annotations are added to the plot to distinguish between the triangulation (red), interior triangles (green), and the original closed polygon (blue).
- The original closed polygon is plotted in blue with a line width of 4 using
CPLplot
.
Example Usage
The function can be called with a sample closed polygon list, such as TRofCPL(CPLsample(16))
, to perform and visualize the triangulation.
Algorithm explaination created using ChatGPT on 2025-08-18 23:41. (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