Syntax
[ASUM,A]=CPLarea(CPL)
Input Parameter
Output Parameter
ASUM : | | Area sum of the surface boundaries |
A : | | Area list for facet list |
Examples
CPLarea(CPLsample(12))
[a,b]=CPLarea_ps(CPLsample(12))
Copyright 2016-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 calculates the area of surfaces defined by a Closed Polygon List (CPL). It uses the polyshape class introduced in MATLAB R2017b.
Input Parameters
- CPL: A Closed Polygon List representing the vertices of the polygon.
Output Results
- ASUM: The total area sum of the surface boundaries.
- A: A list of areas for each facet in the polygon list.
Algorithm Steps
- Check if the CPL is empty. If it is, set ASUM and A to 0 and return.
- Determine the number of separate polygons in the CPL using the
separateNaN
function.
- Create a polyshape object from the CPL without simplifying it.
- Count the number of separate polygons in the polyshape vertices.
- If the number of polygons in the polyshape is less than the original CPL and two output arguments are requested, recreate the polyshape with simplification.
- Initialize an array A to store the area of each polygon.
- Iterate over each polygon and calculate its area using the
area
function, storing the result in A.
- Sum the areas in A to get ASUM.
- If no output arguments are requested, plot the polyshape using
SGfigure
and plot
.
Algorithm explaination created using ChatGPT on 2025-08-19 01:28. (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