Syntax
[VL,VLM,VLP]=VLofgca([allpoints])
Input Parameter
allpoints : | | if false; VL=VLP; if true VL=[VLP;VLM] |
Output Parameter
VL : | | Vertex list |
VLM : | | Vertices of lines |
VLP : | | Vertices of patches |
Examples
SGfigure; SGplot(SGbox([30,20,10])); CPLplot(CPLsample(14));
VLofgca % returns only points of patches
VLofgca(true) % returns all points but of polygons
Copyright 2012-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, VLofgca
, is designed to extract and return the vertices of graphical objects in the current axes of a MATLAB figure. It is part of the SolidGeometry library and was created by Tim Lueth.
Input Parameters
- allpoints: A boolean parameter. If set to
false
, the function returns only the vertices of patches. If set to true
, it returns vertices of both patches and lines.
Output Results
- VL: A list of vertices.
- VLM: Vertices of lines.
- VLP: Vertices of patches.
Algorithm Steps
- Retrieve the
allpoints
parameter using getfuncparams
, defaulting to false
if not provided.
- Get all children of the current axes using
get(gca,'Children')
.
- Identify patch objects among the children using
ispatch
.
- Extract vertices of these patches and store them in
VLP
.
- Identify line objects among the children using
strcmp
to check the type.
- Extract vertices of these lines and store them in
VLM
.
- If
allpoints
is true
, combine VLP
and VLM
into a single list v
.
- Remove any NaN values from
v
using woNaN
.
- If
v
is empty, set VL
to an empty array and return.
- Ensure
v
is a cell array for consistent processing.
- Calculate the total number of vertices and initialize
VL
as an array of NaNs.
- Iterate over each cell in
v
, filling VL
with the vertices.
- If no output arguments are specified, plot the vertices of patches and lines in different colors using
VLplot
.
Algorithm explaination created using ChatGPT on 2025-08-19 07:49. (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