Syntax
SG=SGcolorsample([])
Property names
'text' : if 'text' is used asl argument, the boxes show text descriptors
Output Parameter
Examples
SGcolorsample
SGcolorsample('text')
Copyright 2020-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, SGcolorsample
, generates colored boxes, optionally with text descriptors, using the SolidGeometry library. Below is a detailed explanation of the algorithm and its parameters.
Input Parameters
- varargin: A variable-length input argument list. It can include the string 'text' to indicate that text descriptors should be added to the boxes.
Algorithm Steps
- Check for 'text' Argument: The function uses
getvarg
to check if 'text' is included in varargin
. This determines whether text descriptors will be added to the boxes.
- Initialize Box: A base box
A
is created using SGbox
.
- Loop Through Colors: A loop runs from 1 to 8, each time selecting a color from the string 'kbgcrmyw' using
colofn
.
- Transform and Color Box: For each iteration, the box
A
is transformed using SGtransP
to a new position along the x-axis (i*35, 0, 0).
- Apply Color: The transformed box is colored using
SGcolorfaces
with the selected color.
- Add Text (Optional): If 'text' is true,
SGtextstamp
is used to add a text descriptor to the box, indicating its color.
- Concatenate Boxes: The colored (and possibly labeled) box is concatenated to
B
using SGcat2
.
- Output Result: The final set of boxes is assigned to
SG
.
- Plotting (Optional): If no output argument is specified, the function plots the boxes using
SGfigure
and SGplotalpha
.
Output
- SG: A set of colored boxes, optionally with text descriptors.
This function is part of the SolidGeometry library and was introduced in version 4.9. It is designed to visually demonstrate color coding and optionally label each color for clarity.
Algorithm explaination created using ChatGPT on 2025-08-19 00:08. (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