ispatch

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

returns whether a handle or the current graphics object is a patch

Description

same as strcmp(get(h,'Type'),'patch');

read the documentation on matlab's graphics-objects

Example Illustration

 missing image of ispatch(h)

Syntax

b=ispatch([h])

Input Parameter

h: graphics object handle, default is gco

Output Parameter

b: true/false

Examples


SGfigure; h=[CPLplot(PLcircle(20)); SGplotalpha(SGbox,'g')]
ispatch(h)




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, ispatch, determines if a given graphics object handle in MATLAB is a patch object. It is part of the SolidGeometry library and was introduced by Tim Lueth.

Input Parameters

Output Results

Algorithm Steps

  1. Initialize h with the current graphics object using gco.
  2. Check if there are any input arguments. If there is at least one argument, set h to the first argument provided.
  3. Use the get function to retrieve the 'Type' property of the graphics object handle h.
  4. Compare the 'Type' property with the string 'patch' using strcmp.
  5. Return the result of the comparison as the output b.

Example Usage

The function can be used as follows:

SGfigure; 
h = [CPLplot(PLcircle(20)); SGplotalpha(SGbox, 'g')];
ispatch(h);

This example creates a figure and plots a circle and a box. The ispatch function is then used to check if the plotted objects are patches.

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