SGshowcolors

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 4.4, Creation date: 2018-12-03, Last change: 2025-08-20

shows different colors to understand how to set rgb values

Description

This function was more or less to test different colors of SGwrtiteSTL

See Also: camlightTL , VLFLplotlight , SGshadelight , nofcolmap

Example Illustration

 missing image of SGshowcolors (n,c)

Syntax

SGshowcolors([n,c])

Input Parameter

n:
c:

Examples

SGshowcolors (2)
SGshowcolors (3)
SGshowcolors (4)




Copyright 2018-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, SGshowcolors, is designed to display a grid of colors to help understand how to set RGB values. It is part of the SolidGeometry library and was introduced in version 4.4.

Input Parameters

Algorithm Steps

  1. The function begins by retrieving the input parameter n using getfuncparams. If n is not provided, it defaults to 2.
  2. The value of n is floored to ensure it is an integer.
  3. The total number of colors, nn, is calculated as n^3.
  4. A matrix x is initialized to store RGB values for each color. The matrix has dimensions nn x 3.
  5. If the second parameter c is not provided, it is set to the ceiling of the square root of nn.
  6. The number of rows r is calculated as the ceiling of nn/c.
  7. A nested loop iterates over the range of n for each RGB component (i, k, l). For each combination, an RGB value is calculated and stored in x.
  8. A new figure is created using SGfigure.
  9. A loop iterates over each color index i from 1 to nn:
  10. The function ends by calling shg to bring the figure window to the front.
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