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
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
- CPL: An optional input representing the initial closed polygon list. If not provided, the default is an empty array
[]
.
- col: An optional input specifying the color of the polygon. The default color is
'r-'
, which stands for red.
- linw: An optional input for the line width of the polygon. The default line width is
2
.
Output
- CPL: The final closed polygon list after modifications.
Function Workflow
- 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.
- 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.
- 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.
- 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
- Left Mouse Button: Used to set, remove, and shift points on the polygon.
- Right Mouse Button: Used to shift edges and rotate corners of the polygon.
- Middle Mouse Button: Used to exit the interactive mode.
Example Usage
cla; CPLui()
: Clears the current axes and starts the interactive mode with default settings.
cla; CPLui(CPLsample(3))
: Starts the interactive mode with a sample polygon.
cla; CPLui(CPLsample(3),'b-',3)
: Starts the interactive mode with a sample polygon, blue color, and line width of 3.
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