CPLui

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - CPL/Closed Polygon Lists
Introduced first in SolidGeometry 4.5, Creation date: 2019-03-17, Last change: 2025-09-14

interactive fnct to create and modify CPLS (Only one Contur)

Description

Left Mouse button => Set remove and shift points by
Right Mouse button => Shift at edges, Rotate at corners
Middle Mouse Button => exit
More or less: CPL=VLui(CPL,'','',col,'',linw);

See Also: VLui , CPSlineui , CPSui , PLui , PLsquareui , PLcircleui , VLFLui , SGui , CPLsplitui , Poseofimageui , Poseui , SGTui

Example Illustration

 missing image of CPLui(CPL,col,linw);

Syntax

CPL=CPLui(CPL,[col,linw]);

Input Parameter

CPL: Optional CPL; default is [];
col: Optional color; default is 'r-'
linw: optional line width; default is 2

Output Parameter

CPL: Final CPL

Examples


cla; CPLui()
cla; CPLui(CPLsample(3))
cla; CPLui(CPLsample(3),'b-',3)




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, CPLui, is designed to create and modify closed polygon lists (CPLs) interactively. It is part of the SolidGeometry library and was introduced in version 4.5. The function allows users to manipulate points and edges of a polygon using mouse interactions.

Input Parameters

Output

Function Workflow

  1. The function begins by retrieving the input parameters using the helper function getfuncparams. It assigns default values if parameters are not provided:
    • CPL is set to an empty array if not provided.
    • col is set to 'r-' if not provided.
    • linw is set to 2 if not provided.
  2. The function then calls VLui, another function from the library, passing the CPL, color, and line width as parameters. This function likely handles the interactive user interface for modifying the polygon.
  3. After the interaction, the function extracts the first two columns of the CPL matrix, which likely represent the x and y coordinates of the polygon's vertices.
  4. Finally, the function uses circshift to shift the rows of the CPL matrix by one position, effectively rotating the order of the vertices.

Mouse Interactions

Example Usage

Algorithm explaination created using ChatGPT on 2025-08-19 01:09. (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