VLofgca

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 1.0, Creation date: 2012-07-31, Last change: 2025-09-14

returns all vertices of the current figure patches



See Also: SGofgca , VLFLofgca , PSofgca

Example Illustration

 missing image of VLofgca(allpoints)

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

Output Results

Algorithm Steps

  1. Retrieve the allpoints parameter using getfuncparams, defaulting to false if not provided.
  2. Get all children of the current axes using get(gca,'Children').
  3. Identify patch objects among the children using ispatch.
  4. Extract vertices of these patches and store them in VLP.
  5. Identify line objects among the children using strcmp to check the type.
  6. Extract vertices of these lines and store them in VLM.
  7. If allpoints is true, combine VLP and VLM into a single list v.
  8. Remove any NaN values from v using woNaN.
  9. If v is empty, set VL to an empty array and return.
  10. Ensure v is a cell array for consistent processing.
  11. Calculate the total number of vertices and initialize VL as an array of NaNs.
  12. Iterate over each cell in v, filling VL with the vertices.
  13. 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