VLplotvoxel

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - VM/Voxels
Introduced first in SolidGeometry 5.2, Creation date: 2022-05-19, Last change: 2025-09-15

plots a voxel at the position VL



See Also: VLplot , VLscatter

Example Illustration

 missing image of VLplotvoxel(VL,vs,c,a)

Syntax

VLplotvoxel(VL,[vs,c,a])

Input Parameter

VL: point or list of points
vs: size of voxel; default is [1 1 1]
c: globol color or list of colors of same size as VL
a: globol transparency or list of transparency of same size as VL

Examples


xx=1:1:10; yy=1:1:10; zz=1:1:10;
VL=VLmeshgrid(xx,yy,zz);
SGfigure(-30,30); VLplotvoxel(VL,[1 1 1],'w',0.4);




Copyright 2022-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, VLplotvoxel, is designed to plot voxels at specified positions. It is part of the SolidGeometry library and was introduced in version 5.2. Below is a detailed explanation of the algorithm and its parameters.

Input Parameters

Algorithm Steps

  1. Retrieve the voxel size vs, color c, and transparency a from the input parameters or use default values if not provided.
  2. Determine the number of voxels to plot by calculating the size of VL.
  3. If a is a scalar, replicate it to match the number of voxels.
  4. Normalize the transparency values a using the VMcaxis2 function to ensure they are within a valid range.
  5. Create a base voxel shape using the SGbar function with the specified size vs.
  6. For each point in VL:
    • Transform the base voxel shape to the current point using SGtransP.
    • Define the faces of the voxel using the FL matrix.
    • Create a patch object with the specified faces, vertices, color, and transparency.

Example Usage

The function can be used as follows:

xx = 1:1:10; 
yy = 1:1:10; 
zz = 1:1:10;
VL = VLmeshgrid(xx, yy, zz);
SGfigure(-30, 30); 
VLplotvoxel(VL, [1 1 1], 'w', 0.4);

This example creates a grid of voxels with a size of [1 1 1], white color, and 0.4 transparency.

Algorithm explaination created using ChatGPT on 2025-08-19 07:15. (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