PLlength

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Geometric Queries
Introduced first in SolidGeometry 5.4, Creation date: 2024-06-04, Last change: 2025-09-15

simply the cummulated distance between points of an open list

Description

In Smithonian Espressobar = Yes, there is also lengthC of 2012 already and cumsum(VLdistance)


See Also: lengthC , VLnorm , VLangle , VLdistance

Example Illustration

 missing image of PLlength(b)

Syntax

ll=PLlength(b)

Input Parameter

b: Point list

Output Parameter

ll: length of open list

Examples


PLlength([])
PLlength([0 0])
PLlength([0 0;10 0])
PLlength([0 0;10 0; 0 0])




Copyright 2024-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 algorithm calculates the cumulative distance between points in an open list, effectively measuring the length of a polyline defined by a series of points.

Input Parameters

Output Results

Algorithm Steps

  1. Check if the number of points in the list b is less than 2. If true, set the length ll to 0 and return, as there are not enough points to form a line.
  2. Calculate the difference between each point and the next point in the list using circshift(b,-1), which shifts the list to align each point with its successor.
  3. Compute the Euclidean distance between each pair of consecutive points using vecnormr, which calculates the norm of each row vector.
  4. Use cumsum to compute the cumulative sum of these distances, effectively summing the lengths of each segment of the polyline.
  5. Extract the last value of the cumulative sum, which represents the total length of the polyline, and assign it to ll.

This function is part of the SolidGeometry library and is used to calculate the length of open polygonal chains.

Algorithm explaination created using ChatGPT on 2025-08-18 22:57. (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