CPLplotregions

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 4.3, Creation date: 2018-10-18, Last change: 2025-09-14

plots the regions of a CPL / polyshape in different colors



See Also: CPLplotasPS , CPLplot , CPLfaceplot , CPLplotcolors , CPLplotinout

Example Illustration

 missing image of CPLplotregions(CPL,ind)

Syntax

h=CPLplotregions(CPL,[ind])

Input Parameter

CPL: Closed polygon
ind: index of regions; default is all

Output Parameter

h: handle to graphics objects

Examples


SGfigure; CPLplotregions(CPLsample(14))




Copyright 2018-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, CPLplotregions, is designed to plot regions of a closed polygon list (CPL) using different colors. It is part of the SolidGeometry library and was introduced in version 4.3.

Input Parameters

Output

Algorithm Steps

  1. The function begins by calling getfuncparams to determine the simplification parameter for the polygon. This function checks the input arguments and returns a boolean indicating whether to simplify the polygon.
  2. A polyshape object is created from the CPL using the simplification parameter. This object represents the geometric shape of the polygon.
  3. The regions function is called on the polyshape object to obtain the individual regions of the polygon.
  4. The getfuncparams function is called again to determine the indices of the regions to be plotted. If no specific indices are provided, it defaults to all regions.
  5. An empty array h is initialized to store the handles to the graphics objects.
  6. The function separateNaN is called on the CPL, which likely separates the polygon into distinct parts if there are NaN values indicating breaks.
  7. A loop iterates over the specified indices of the regions. For each region, the CPLplot function is called with the vertices of the region and a color determined by colofn. The color is selected from a predefined set ('rbgkcym') and a default ('r-').
  8. The handle returned by CPLplot is appended to the array h.

The function concludes by returning the array h, which contains the handles to the plotted regions.

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