CPLarea

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Geometric Queries
Introduced first in SolidGeometry 2.8, Creation date: 2016-01-10, Last change: 2025-09-14

returns the area of the surfaces (VL/PL)

Description

With respect to Heron: A=sqrt(s(s-a)(s-b)(S-c)); s=0.5*(a+b+c).
New code created with classe polyshape,introduced in R2017b


See Also: SGarea , VLFLarea , CPLlength

Example Illustration

 missing image of CPLarea(CPL)

Syntax

[ASUM,A]=CPLarea(CPL)

Input Parameter

CPL: Closed Polygon List

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

Output Results

Algorithm Steps

  1. Check if the CPL is empty. If it is, set ASUM and A to 0 and return.
  2. Determine the number of separate polygons in the CPL using the separateNaN function.
  3. Create a polyshape object from the CPL without simplifying it.
  4. Count the number of separate polygons in the polyshape vertices.
  5. 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.
  6. Initialize an array A to store the area of each polygon.
  7. Iterate over each polygon and calculate its area using the area function, storing the result in A.
  8. Sum the areas in A to get ASUM.
  9. 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